xmax=2;
steps=64;
maxiter=63;

Z=0;
X=[-xmax:2*xmax/(steps-1):xmax];
Y=[-xmax:2*xmax/(steps-1):xmax];

cjulia = 0.0 + i*.8;

for m=1:steps
  c=i*(-xmax+2*xmax*m/steps);
  for n=1:steps
    c=-xmax+2*xmax*n/steps-.5 + i*imag(c);
    z=c;
    for r=0:maxiter
      z=z*z+cjulia;
      if abs(z)>4 break
      end
    end
    % Z(m,n)=sqrt(r/maxiter);
    Z(m,n) = floor(r/4);
  end
end

figure(1);
mesh(X,Y,Z)
figure(2);
contour (X, Y, Z)
