• Remix
  • Share
  • New Entry

  • michio

  • /
  • Fractals Everywhere: Barnsley Fern

on 4 Oct 2021
  • 91
  • 1.41K
  • 4
  • 0
  • 269
x=[0;0];
n=x;
N=1e5;
r=rand(1,N);
for i=1:N
x=nextp(x,r(i));
n=[n,x];
end
plot(n(1,:),n(2,:),'.','MarkerSize',2)
axis off
function n=nextp(x,r)
b=[0;160];
if r<0.85
A=[85 4;-4 85];
elseif r<0.92
A=[20 -26;23 22];
elseif r<0.99
A=[-15 28;26 24];b=[0;44];
else
A=[0 0;0 16];b=[0;0];
end
n=(A*x+b)/100;
end
Remix Tree
Load full remix tree