MATLAB Animation with circles



MATLAB Program:


figure
pause(10);
t=0:0.001:2*pi;
x=cos(t);
y=sin(t);
plot(x,y);
axis([-1.5 1.5 -1.5 1.5]);
axis equal;
pause(1);
hold on;
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
plot(x2,y2);
axis([-1.5 1.5 -1.5 1.5]);
axis equal;
pause(1);
clf
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
plot(x2,y2);
axis([-1.5 1.5 -1.5 1.5]);
axis equal;
pause(1);
hold on;
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    plot(x3,y3);
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1)
clf
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    plot(x3,y3);
   axis([-1.5 1.5 -1.5 1.5]);
   axis equal;
    hold on;
    i=i+1;
end
pause(0.5);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'y');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'m');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'c');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'r');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'g');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'b');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.1;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
    fill(x3,y3,'k');
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
    hold on;
    i=i+1;
end
pause(1);
clf
t=0:pi/6:2*pi;
x2=cos(t);
y2=sin(t);
t=0:0.001:2*pi;
k=0.01;
for i=1:length(x2)
    x3=x2(i)+k*cos(t);
    y3=y2(i)+k*sin(t);
   fill(x3,y3,'r');
 
    axis([-1.5 1.5 -1.5 1.5]);
    axis equal;
     pause(1);
    hold on;
    i=i+1;
    k=k+0.01;
end


No comments