2007年3月27日 星期二

作業四

題目一


L=16+10;
axis equal;
AXIS([-30 60 -30 60]);
a=[0 0 0;26*cosd(0) 26*sind(0) 0;26*cosd(60) 26*sind(60) 0;0 0 0];
b=line(a(:,1),a(:,2)); %連線;將矩陣轉換成圖形
for n=1:30 %旋轉次數
rotate(b,[0 0 1],12,[0 0 0]); %旋轉(圖形,旋轉軸,角度,旋轉中心)
pause(0.05); %每次間隔時間
end
for n=1:30
rotate(b,[0 0 1],12,[13 13*3^(1/2) 0]);
pause(0.05);
end
for n=1:30
rotate(b,[0 0 1],12,[26 0 0]);
pause(0.05);
end




題目二

linkshape([10 0],[0 0],4)
x=10;
y=0;
x1=[15];
y1=[0];
for n=1:10:360;
x2=x*cosd(n);
y2=-x*sind(n);
linkshape([x2 y2], [0 0], 4)
line([x1,x2],[y1,y2]);
end




題目三

linkshape([0 0],[10 0],2); %AD桿
linkshape([0 0],[3 4],3); %AB桿
linkshape([3 4],[13 4],1.5); %BC桿
linkshape([13 4],[10 0],2); %CD桿
for n=1:30:360
a=3*cosd(n)+4*sind(n);
b=-3*sind(n)+4*cosd(n);
c=13+(a-3);
d=b;
linkshape([a b],[0 0],2);
linkshape([c d],[a b],3);
linkshape([10 0],[c d],1.5);
linkshape([0 0],[10 0],2);
end;

1 則留言:

不留白老人 提到...

不要吝於詳細說明。