Monday, July 03, 2006

MATLAB 5.3: Plotting

We were given three variables x, y1 and y2 and are asked to make two graphs and show procedures and results.

%two graphs are to be plotted along with rows and columns
clc
disp('Your name here')
x=0:10;
y1=0:10:100;
y2=[0,1,4,9,16,25,36,49,64,81,100];
disp(y1);
disp([y1]');
firstcomp=y2(6);
disp(firstcomp)
subplot(2,1,1),plot(x,y1);
title('Homework #? Graph');
xlabel('X Values''Y1 Values');
subplot(2,1,2),plot(x,y1,x,y2,'o');
title('Homework #? Graph');
xlabel('X Values'),ylabel('Y2 Values')
Your name here
0 10 20 30 40 50 60 70 80 90 100

0
10
20
30
40
50
60
70
80
90
100

25

No comments: