make a mandelbrot set

hi, i want to draw the mandelbrot set without the instruction (z=z.^2+c) because i will manipulate the X's and Y's there is my code :
if true
precision = 0.01;
Nmax = 500;
X=-2.5:precision:1.5;
Y=-1.5:precision:1.5;
[x,y]=meshgrid(X,Y);
xZ=x;
yZ=y;
c=x+i*y;
test=0.;
xC=real(c);
yC=imag(c);
for n=1:Nmax;
xZ=xZ.^2-yZ.^2+x;
yZ=2.*xZ.*yZ+y;
z=xZ+i*yZ;
test=test+(abs(yZ.^2+xZ.^2)<=4);
n;
end;
mesh(X,Y,log(test+10));
colormap(hot.^0.6);
axis([-2.5 1.5 -1.5 1.5]);
axis off;
end
but i have something wrong i don't know what it is ?
please help

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Fractals 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by