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 = linspace(0,1,200);y = humps(x);subplot(221)plt(x,y)text(.5,1,’Scale = 1’,...’units’,’normalized’)subplot(222)plt(x/7,y/7)text(.5,1,’Scale = 1/7’,...’units’,’normalized’)Notice that the text comm<strong>and</strong>s here use the same positional references,being x =0.5 <strong>and</strong> y = 1 in normalized units.Another example shows a plot <strong>and</strong> a zoomed portion:load clownsubplot(221)imagesc(X)colormap(map)axis image <strong>of</strong>fhold onplot([150 230 230 150 150],...[100 100 60 60 100])subplot(223)imagesc(X(60:100,150:230))axis image <strong>of</strong>faxesaxis manualhold onx = [.195 0 NaN .301 .419];y = [.793 .348 NaN .793 .348];plt(x,y)axis <strong>of</strong>fThe statement axis manual is needed here to freeze the axes limits attheir default values. To produce the x <strong>and</strong> y data for the zoom-lines,I used the ginput comm<strong>and</strong> to obtain the coordinates with the mouse.The ginput comm<strong>and</strong> gets input from the current axes. So if you wantto add more points to the invisible axis, you must make it visible again,otherwise your mouse click will be interpreted with reference to the lastplotted (visible) axes.34 Graphical User InterfacesA graphical user interface (GUI) is a system <strong>of</strong> graphical elements thatallow a user to interact with s<strong>of</strong>tware using mouse operations. There arethree ways to make graphical user interfaces:c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!