%function to draw Mandelbrot set with inputs

function mandel(center, radius,n)

tic;
cx=real(center);
cy=imag(center);
delta=2*radius/n;
x=[cx-radius:delta:cx+radius];
y=[cy-radius:delta:cy+radius];
[X,Y] = meshgrid(x,y);
z0=X+i*Y;
z=zeros(n+1,n+1);
c=zeros(n+1,n+1);
depth=50;
for k=1:depth
z=z.^2+z0;
c(abs(z)<2)=k;
end
image(c)
axis image
colormap(flipud(jet(depth)))
toc;

return;