Fourth Lesson plotting Data Drawing Data
t = [0,0.01,0.98];
y1 = sin (2*pi*4*t);
y2 = cos (2*pi*4*t);
Plot (t,y1);( drawing Figure 1)
Hold on; ( Figure 1 does not disappear)
Plot (T,y2, ' R ');( draw in red Figure 2)
Xlable (' time ') ( horizontal axis name)
Ylable (' value ') ( vertical axis name)
Legend (' Sin ', ' cos ')(labeled two function curves)
Title (' My Plot ')
Print-dpng ' Myplot.png ' ( save image)
CD '/home/flipped/desktop ' Print-dpng ' myplot.png ' ( save image to desktop)
Close(image off)
Label the image ( two graphs appear on the desktop)
Figure (1); Plot (t,y1);
Figure (2); Plot (t,y2);
The sin and cos curves are drawn on an image (The sin curve on the left and the Cos curve on the right)
Subplot (1,2,1); divide the image into 1*2 lattice, using the first lattice
Plot (t,y1); Draw Figure 1 in the first lattice
Subplot (1,2,2); divide the image into 1*2 lattice, using the second lattice
Plot (t,y2); Draw Figure 2 in a second lattice
Change the scale of the axis
Axis ([0.5 1-1 1]) (The x-axis scale of Figure 2 is changed from 0.5 to 1, and the y -axis scale is changed from 1 to 1)
Clear image
ClF
A = Magic (5) 5*5magic matrix
Imagesc (A) draw 5*5 color squares, different colors corresponding to different values in the matrix
Imagesc (The Magic ()), Colorbar,colormap Gray; Draw 15*15 Gray distribution, add a color bar to the right (show values corresponding to different colors)
Octave Tutorial ("machine learning"), Part IV, "drawing data"