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(-1,1,8192);Fs = 1000;y = vco(x,[0 500],Fs);plot(y(1:1000))axis([0 1000 -5 5])zeroaxesWe used the axis comm<strong>and</strong> to set the y-axis limits to [-5 5] instead<strong>of</strong> the default limits, in this case, <strong>of</strong> [-1 1]clfplot(y(1:1000))which makes the variation in frequency slightly less apparent, <strong>and</strong> isjust too gr<strong>and</strong>iose. The eye can pick up very subtle variations in linestraightness, but here the variation is so huge that the lines becomeparallel <strong>and</strong> begin to produce the optical illusion <strong>of</strong> vibration. Also,lines that are very nearly vertical or horizontal begin to be affected bythe finite resolution <strong>of</strong> dot printers. Using H<strong>and</strong>le Graphics we canachieve a more elegant result by reducing the height <strong>of</strong> the y-axis. Wedo this by setting the position property <strong>of</strong> the current axes:set(gca,’Position’,[.1 .5 .8 .1],’box’,’<strong>of</strong>f’)The gca input is itself a function, which returns the h<strong>and</strong>le to the currentset <strong>of</strong> axes. We are saying that we want to set the position <strong>of</strong> the currentaxes to be equal to the vector [.1 .1 .8 .1]. The position vector hasthe form [left, bottom, width, height ], in units normalised to thefigure window; (0, 0) is the bottom left <strong>and</strong> (1, 1) is the top right. Butperhaps we should shrink it even further, <strong>and</strong> dispense with the everpresentaxes:set(gca,’Position’,[.1 .5 .8 .01],’visible’,’<strong>of</strong>f’)c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!