- /
-
Spiral
on 22 Oct 2021
- 34
- 38
- 0
- 0
- 274
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/(pi*r*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,50,g,'filled','o')
colormap(jet)
axis equal off