xmax=2;
steps=100;
maxiter=32;

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

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+c;
      if abs(z)>2 break
      end
    end
    Z(m,n)=sqrt(r/maxiter);
  end
end

mesh(X,Y,Z)