Spiral art using Circles in MATLAB
MATLAB Program:
%Code:
%https://www.matlabcoding.com/
figure;
pause(10);
fill([-40
-40 40 40],[-40 40 40 -40],'k');
hold
on;
t=0:0.1:10*pi;
x=t.*cos(t);
y=t.*sin(t);
r=0.02;
m=0;
for i=1:length(x)
if(rem(m,2)==0)
a=x(i)+r*cos(t);
b=y(i)+r*sin(t);
fill(a,b,'w');
else
a=x(i)+r*cos(t);
b=y(i)+r*sin(t);
fill(a,b,'k');
end
m=m+1;
hold on;
axis ([-40 40 -40 40]);
axis square;
pause(0.1);
r=r+0.02;
end
No comments