贡献者: addis
1 这里给出一个 Julia 分形的演示程序,运行结果如图 1 。
function julia_set
close all;
N = 1000;
scale = 1.5;
x = linspace(-1, 1, N); y = x;
[X, Y] = ndgrid(x, y);
I = julia2(X*scale, Y*scale);
I(I > 1000) = 1000;
surfCart(x, x, I);
caxis([0, 500]);
end
function I = julia2(X, Y)
c = -0.8 + 0.15745i;
Z = X + 1i*Y;
for i=1:80
Z = Z .* Z + c;
end
I = abs(Z); % I = I/max(I(:));
end