%script file to make a movie zooming in to a plot of a %newton iteration function %parameters for the function C(z)=z^3+a*z+b a=1.5; b=0; p=[1 0 a b]; %numerical values for the roots rts=roots(p); %input zoom parameters center=1+0*i; lbo=-2; ubo=2; rate=.3 maxzoom=10; gridsize=200; %loop through window sizes, plotting at each stop for g=1:maxzoom lb=center+(lbo*rate^g); ub=center+(ubo*rate^g); increment=(ub-lb)/gridsize; [X,Y]=meshgrid([lb:increment:ub]); [m,n]=size(X); maxiters=30; T=64*ones(m,n); for j=1:m fprintf ('on iterate %d\n',j); for k=1:n z=X(j,k)+i*Y(j,k); for t=1:maxiters y=z-(z^3+a*z+b)/(3*z^2+a); z=y; if abs(z-rts(1))<.001 T(j,k)=1+t*(20/maxiters); break; end if abs(z-rts(2))<.001 T(j,k)=26+t*(15/maxiters); break; end if abs(z-rts(3))<.001 T(j,k)=45+t*(24/maxiters); break; end end end end image(T) pause(0.1); %get the image as a movie frame M(:,g)=getframe; end movie(M,3);