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.

If you zoom in on the right h<strong>and</strong> plot you’ll find that this growth rate istoo fast for the period between 1990 <strong>and</strong> 1996.Exercise 5 (Page 55)The following m-file illustrates how to generate a 2-dimensional sinusoid<strong>and</strong> its FFT. Experiment with the relative x <strong>and</strong> y frequencies <strong>and</strong> seethe effect on the FFT. Try different functions <strong>of</strong> x <strong>and</strong> y. Try addingsome noise. Try plotting the logarithm <strong>of</strong> P.t=linspace(-pi,pi,64);[x,y]=meshgrid(t);z = sin(3*x + 9*y);Z = fft2(z);P = fftshift(abs(Z).^2);f = fftfreq(0.5, length(t));clfcolormap([0 0 0])subplot(221)mesh(x,y,z)axis([-pi pi ...-pi pi ...-15 15])view([60 50])xlabel(’x’)ylabel(’y’)title(’Signal’)subplot(223)mesh(f,f,P)axis tightview([60 50])xlabel(’x-frequency’)ylabel(’y-frequency’)title(’Transform’)c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!