clear
cr=0.181;
ci=-0.667;
dx=0.01;
minx=-1.3;
maxx=1.3;
n = 20;
M = 100;
x=minx:dx:maxx;
y=minx:dx:maxx;
[X,Y]=meshgrid(x,y);

for j=1:n
   Zr=X.^2-Y.^2+cr;
   Zi=2*X.*Y+ci;        
   Zr(Zr>M)=M;
   Zr(Zr<-M)=-M;
   Zi(Zi>M)=M;
   Zi(Zi<-M)=-M; 
   X=Zr;
   Y=Zi;
end

clf
subplot(1,2,1)  
grayplot(x,y,X);
subplot(1,2,2)  
grayplot(x,y,Y);

