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.

xcentre = -0.6;ycentre = 0;L = 1.5;x = linspace(xcentre - L,xcentre + L,N);y = linspace(ycentre - L,ycentre + L,N);[X,Y] = meshgrid(x,y);Z = X + i*Y;Z0 = Z;for k = 1:50;Z = Z.^2 + Z0;endind1 = find(isnan(Z));ind2 = find(~isnan(Z));Z(ind1) = 1;Z(ind2) = 0;contour(x,y,abs(Z),[.5 .5])grid;boxaxis equal <strong>of</strong>fYou must tell the pr<strong>of</strong>ile comm<strong>and</strong> which function you want to lookat. The format <strong>of</strong> this comm<strong>and</strong> changed between matlab versions 5.2<strong>and</strong> 5.3.Pr<strong>of</strong>ile in <strong>MATLAB</strong> 5.2Initiate the pr<strong>of</strong>iler in matlab version 5.2 by typing:pr<strong>of</strong>ile m<strong>and</strong>elbrotNow go ahead <strong>and</strong> run the function:m<strong>and</strong>elbrotTo see where matlab spent most <strong>of</strong> its time, type:>> pr<strong>of</strong>ile reportTotal time in "m<strong>and</strong>elbrot.m": 30.12 seconds100% <strong>of</strong> the total time was spent on lines:[15 21 12 18 17 19 11 20 22 16 ]c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!