function []=mandel(r) % MANDEL % The command mandel(res) produces a plot of the Mandelbrot set for % Z0=0 in full color with resolution in both real and imaginary directions % of res points. If no resolution is supplied, the default is 100. % % When the plot is complete, the mouse can be used to zoom in on a % specific area. Clicking on a single point will cause that spot to be % blown up by a factor of 100. Clicking in the title bar will exit the % routine. % RJM 1/11/97 if nargin==0, r=100;, end flag=0; xmin=-2;, xmax=1; ymin=-1.5;, ymax=1.5; figure(1); while flag==0, m=zeros(r); x=0;,y=0; i=sqrt(-1); z0=0; xx=linspace(xmax,xmin,r); yy=linspace(ymin,ymax,r); for a=xx,x=x+1; % up and down for b=yy,y=y+1; % horizontal c=a+i*b; k=0; z=z0; while (z<10000)&(k<128), z=z.^2+c; k=k+1; end m(x,y)=k; end y=0; end figure(1),surf(xx,yy,log(log(m'))),view(0,90),shading('interp') title('Click on figure to zoom -or- Click here ( ) to end') [xnew,ynew]=ginput(1); if ynew > ymax, flag=1;, end xd=xmax-xmin; xmax=xnew+xd/20; xmin=xnew-xd/20; yd=ymax-ymin; ymax=ynew+yd/20; ymin=ynew-yd/20; end