Skip to content

Instantly share code, notes, and snippets.

@pollend
Last active September 18, 2017 03:50
Show Gist options
  • Save pollend/dda278db408d135fb5065b838b7a3cc7 to your computer and use it in GitHub Desktop.
Save pollend/dda278db408d135fb5065b838b7a3cc7 to your computer and use it in GitHub Desktop.
Julian set in matlab
[X,Y] = meshgrid(-1:.001:1);
Z = ones(size(X));
for x_ = 1: size(X,1)
for y_ = 1: size(X,1)
u = [X(x_,y_),Y(x_,y_)];
for i = 1:100
v = [u(1) * u(1) - u(2) * u(2)+ -0.550, u(2) * u(1) + u(2) * u(1)+ -0.550];
if((v(1) * v(1) + v(2) * v(2)) > 4)
break
end
u = v;
Z(x_,y_) = i;
end
end
end
X = X(:);
Y = Y(:);
imagesc(X,Y,Z)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment