12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

x = [[1 2 3 4]’ [2 3 4 5]’ [3 4 5 6]’]x =1 2 32 3 43 4 54 5 6>> plot(x,q)>> grid4.4 Clearing the Figure WindowYou can clear the plot window by typing clf, which st<strong>and</strong>s for ‘clearfigure’. To get rid <strong>of</strong> a figure window entirely, type close. To get rid<strong>of</strong> all the figure windows, type close all. New figure windows can becreated by typing figure.4.5 SubplotsTo plot more than one set <strong>of</strong> axes in the same window, use the subplotcomm<strong>and</strong>. You can typesubplot(m,n,p)to break up the plotting window into m plots in the vertical direction<strong>and</strong> n plots in the horizontal direction, choosing the pth plot for drawinginto. The subplots are counted as you read text: left to right along thetop row, then left to right along the second row, <strong>and</strong> so on. Here is anexample (do not forget to use the ↑ key to save typing):t = 0:.1:2*pi;subplot(2,2,1)plot(cos(t),sin(t))subplot(2,2,2)plot(cos(t),sin(2*t))subplot(2,2,3)plot(cos(t),sin(3*t))subplot(2,2,4)plot(cos(t),sin(4*t))If you want to clear one <strong>of</strong> the plots in a subplot without affectingthe others you can use the cla (clear axes) comm<strong>and</strong>. Continuing theprevious example:c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!