• New Entry

Spiral art with random digits

KSSV on 21 Oct 2021
  • 41
  • 85
  • 2
  • 0
  • 276
t=0;
r=1;
d=.1;
g=zeros([],1);
x=g;
y=g;
j=1;
x(j) = r*sin(t) ;
y(j) = r*cos(t) ;
g(j)=randi(10,1) ;
for i = 2:100000
dt=d/r;
dr=d^2/(2*pi*r);
t=t+dt;
r=r-dr;
if r>d
j=j+1 ;
g(j) = randi(10,1) ;
x(j) = r*sin(t);
y(j) = r*cos(t) ;
end
end
figure('color','k')
scatter(x,y,10,g,'filled','o')
colormap(turbo)
axis equal off
Remix Tree