Octave Tutorial ("machine learning"), Part IV, "drawing data"

Source: Internet
Author: User
Tags cos sin

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.