L=29+10;
triangle=[0 0;L 0;L/2 L/2*3^(1/2);0 0];
h=line(triangle(:,1),triangle(:,2));
axis equal;
for i=1:1:360;
axis([-100 100 -100 100]);
rotate(h,[0 0 1],1,[0 0 0]);
pause(0.0001);
end;
for i=1:1:360;
axis([-100 100 -100 100]);
rotate(h,[0 0 1],1,[L 0 0]);
pause(0.0001);
end;
for i=1:1:360;
axis([-100 100 -100 100]);
rotate(h,[0 0 1],1,[L/2 L/2*3^(1/2) 0]);
pause(0.0001);
end;
p4-2
for thera=1:1:360;
x=10*cosd(thera);
y=10*sind(thera);
linkshape([0 0],[x y],4);
axis([-20 20 -20 20]);
line([15 x],[0 y]);
pause(0.001);
end;
以線代表彈簧
p4-3
for thera=1:30:360;
bx=3*cosd(thera);
by=4*sind(thera);
cx=3*cosd(thera)+10;
cy=4*sind(thera);
hold on;
linkshape([0 0],[bx by],2)
linkshape([bx by],[cx cy],3)
linkshape([cx cy],[10 0],1.5)
linkshape([10 0],[0 0],2)
pause(0.001);
end;
沒有留言:
張貼留言