2007年3月27日 星期二

學號:B94611009 姓名:楊子羲

第1題


上圖為全部的三角形所留下來的軌跡圖

l=19
for theta=0:5:360
clf;axis([-25 50 -25 50])
a=[0 0;l*cosd(60+theta) l*sind(60+theta);l*cosd(0+theta) ,l*sind(0+theta);0 0]
line(a(:,1),a(:,2))
pause(0.001);axis equal
end

l=19
for theta=0:5:360
clf;axis([-25 50 -25 50])
b=[0+l*cosd(60) 0+l*sind(60);l*cosd(-120+theta)+l*cosd(60) l*sind(-120+theta)+l*sind(60);l*cosd(-60+theta)+l*cosd(60) ,l*sind(-60+theta)+l*sind(60);0+l*cosd(60) 0+l*sind(60)]
line(b(:,1),b(:,2))
pause(0.001);axis equal
end

l=19
for theta=0:5:360
clf;axis([-25 50 -25 50])
c=[0+19 0;l*cosd(120+theta)+19 l*sind(120+theta);l*cosd(180+theta)+19 l*sind(180+theta);0+19 0]
line(c(:,1),c(:,2))
pause(0.001);axis equal
end


從第二題開始會用到連桿的程式 以下的程式是參考教授的網頁
function linkshape(A,B,dd)
if nargin==2,dd=1;end;
d=abs(dd);AB=(B(1)+j*B(2))-(A(1)+j*A(2));
D=abs(AB);th=angle(AB);
t=linspace(pi/2,2.5*pi,20);
Cout=max(d/2,0.2)*exp(j*t');
Cin=Cout/2;
if dd>0,
P=[0;Cin;Cout(1:10);D+Cout(11:20);D+Cin;D+Cout(20);Cout(1)];
else P=[Cin;0;D;D+Cin];end
xx=real(P);
yy=imag(P);
x=xx*cos(th)-yy*sin(th)+A(1);
y=xx*sin(th)+yy*cos(th)+A(2);
line(x,y);
axis equal


第2題

for theta=0:30:360;
linkshape([0 0],[10*cosd(theta) 10*sind(theta)],4)line([10*cosd(theta) 15],[10*sind(theta) 0]);
axis equal;
end

第三題
1.


linkshape([0 0],[10 0],2)
linkshape([0 0],[3 4],3)
linkshape([3 4],[13 4],1.5)
linkshape([13 4],[10 0],2)

2.


for theta=0:30:360
linkshape([0 0],[10 0],2)
linkshape([0 0],[5*cosd(atand(4/3)+theta) 5*sind(atand(4/3)+theta)],3)
linkshape([5*cosd(atand(4/3)+theta) 5*sind(atand(4/3)+theta)],[5*cosd(atand(4/3)+theta)+10 5*sind(atand(4/3)+theta)],1.5)linkshape([5*cosd(atand(4/3)+theta)+10 5*sind(atand(4/3)+theta)],[10 0],2);
axis equal;
end

3.



linkshape([0 0],[10 0],2)
for theta=0:30:360 theta2=atand(4/3)+theta

linkshape([0 0],[5*cosd(theta2) 5*sind(theta2)],3)
if theta2<=180 || theta2>360

linkshape([5*cosd(theta2) 5*sind(theta2)],[5*cosd(theta2)+10 5*sind(theta2)],1.5)
linkshape([5*cosd(theta2)+10 5*sind(theta2)],[10 0],2)

else if theta2>180 && theta2<=360
linkshape([5*cosd(theta2) 5*sind(theta2)],[5*cosd(theta2)+10 -5*sind(theta2)],1.5)
linkshape([5*cosd(theta2)+10 -5*sind(theta2)],[10 0],2)
axis equal

end
end
pause(0.5)
end

下面是我先做好的 之後才找到教授的連桿
所以非常的土法煉鋼

第3題


1.


t=0 % t為角度
ab=[1.5*cosd(90+atand(4/3)+t) 1.5*sind(90+atand(4/3)+t);(109/4)^(1/2)*cosd(atand(3/10)+atand(4/3)+t) (109/4)^(1/2)*sind(atand(3/10)+atand(4/3)+t);(109/4)^(1/2)*cosd(-atand(3/10)+atand(4/3)+t) (109/4)^(1/2)*sind(-atand(3/10)+atand(4/3)+t);1.5*cosd(-90+atand(4/3)+t) 1.5*sind(-90+atand(4/3)+t);1.5*cosd(90+atand(4/3)+t) 1.5*sind(90+atand(4/3)+t)]
cd=[1*cosd(90+atand(4/3)+t)+10 1*sind(90+atand(4/3)+t);(26)^(1/2)*cosd(atand(1/5)+atand(4/3)+t)+10 (26)^(1/2)*sind(atand(1/5)+atand(4/3)+t);(26)^(1/2)*cosd(-atand(1/5)+atand(4/3)+t)+10 (26)^(1/2)*sind(-atand(1/5)+atand(4/3)+t);1*cosd(-90+atand(4/3)+t)+10 1*sind(-90+atand(4/3)+t);1*cosd(90+atand(4/3)+t)+10 1*sind(90+atand(4/3)+t)]
ad=[0 1;10 1;10 -1;0 -1;0 1]
bc=[5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)+0.75;5*cosd(atand(4/3)+t)+10 5*sind(atand(4/3)+t)+0.75;5*cosd(atand(4/3)+t)+10 5*sind(atand(4/3)+t)-0.75;5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)-0.75;5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)+0.75]
line(ab(:,1),ab(:,2));axis equal
line(cd(:,1),cd(:,2))
line(ad(:,1),ad(:,2))
line(bc(:,1),bc(:,2))

2.

for t=0:30:360 % t為角度
ab=[1.5*cosd(90+atand(4/3)+t) 1.5*sind(90+atand(4/3)+t);(109/4)^(1/2)*cosd(atand(3/10)+atand(4/3)+t) (109/4)^(1/2)*sind(atand(3/10)+atand(4/3)+t);(109/4)^(1/2)*cosd(-atand(3/10)+atand(4/3)+t) (109/4)^(1/2)*sind(-atand(3/10)+atand(4/3)+t);1.5*cosd(-90+atand(4/3)+t) 1.5*sind(-90+atand(4/3)+t);1.5*cosd(90+atand(4/3)+t) 1.5*sind(90+atand(4/3)+t)]
cd=[1*cosd(90+atand(4/3)+t)+10 1*sind(90+atand(4/3)+t);(26)^(1/2)*cosd(atand(1/5)+atand(4/3)+t)+10 (26)^(1/2)*sind(atand(1/5)+atand(4/3)+t);(26)^(1/2)*cosd(-atand(1/5)+atand(4/3)+t)+10 (26)^(1/2)*sind(-atand(1/5)+atand(4/3)+t);1*cosd(-90+atand(4/3)+t)+10 1*sind(-90+atand(4/3)+t);1*cosd(90+atand(4/3)+t)+10 1*sind(90+atand(4/3)+t)]
ad=[0 1;10 1;10 -1;0 -1;0 1]
bc=[5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)+0.75;5*cosd(atand(4/3)+t)+10 5*sind(atand(4/3)+t)+0.75;5*cosd(atand(4/3)+t)+10 5*sind(atand(4/3)+t)-0.75;5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)-0.75;5*cosd(atand(4/3)+t) 5*sind(atand(4/3)+t)+0.75]
line(ab(:,1),ab(:,2));axis equal
line(cd(:,1),cd(:,2))
line(ad(:,1),ad(:,2))
line(bc(:,1),bc(:,2))

end

沒有留言: