Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

Cycle in MATLAB

MATLAB Program for Cycle.

%Code:

t=0:0.01:2*pi;
x=0.75*cos(t);
y=0.75*sin(t);
plot(x,y,'k','linewidth',3);
pause(1);
axis equal;
hold on;
t=0:2*pi/12:2*pi;
x=0.75*cos(t);
y=0.75*sin(t);
for i=1:length(t)
    plot([0 x(i)],[0 y(i)],'k');
    pause(0.1);
end
t=0:0.01:2*pi;
x=5+0.75*cos(t);
y=0.75*sin(t);
plot(x,y,'k','linewidth',3);
axis equal;
pause(1);
t=0:2*pi/12:2*pi;
x=5+0.75*cos(t);
y=0.75*sin(t);
for i=1:length(t)
    plot([5 x(i)],[0 y(i)],'k');
    pause(0.1);
end
axis equal;
hold on;
plot([0 3],[0 0],'k','linewidth',3);
pause(1);
plot([0 1],[0 1.5],'k','linewidth',3);
pause(1);
plot([3 4],[0 1.5],'k','linewidth',3);
pause(1);
plot([1 4],[1.5 1.5],'k','linewidth',3);
pause(1);
plot([5 4 3],[0 1.5 2],'k','linewidth',3);
pause(1);
plot([3 2.5],[2  2],'k','linewidth',3);
pause(1);
plot([1 1],[1.5  1.7],'k','linewidth',3);
pause(1);
plot([0.8 1.2],[1.7  1.7],'k','linewidth',3);


No comments

Popular Posts

Followers