21 lines
421 B
Text
21 lines
421 B
Text
function z = mandelbrot()
|
|
% to view the image call "image(mandelbrot())"
|
|
width = 500; height = 500;
|
|
z = zeros(width, height);
|
|
c = zeros(width, height);
|
|
|
|
xi = 1;
|
|
for x = linspace(-2, 2, width)
|
|
yi = 1;
|
|
for y = linspace(-2, 2, height)
|
|
c(yi, xi) = x+y*i; yi += 1;
|
|
end
|
|
xi += 1;
|
|
end
|
|
|
|
for iter = 1:50
|
|
z = z.*z + c;
|
|
end
|
|
|
|
z = abs(z);
|
|
end
|