顯示具有 機動學 標籤的文章。 顯示所有文章
顯示具有 機動學 標籤的文章。 顯示所有文章

2007年6月10日 星期日

作業五(改)

5.1
以人體為例,其手臂的動作可以視為三支桿,分別由上手臂,下手臂及手掌等三部份組成。其連結點分別為BCD,上手臂長為L1,下手臂長為L2,手掌長為L3,分別為三連桿,其連結點均屬旋轉結。

1. 試分別以一線畫繪出上手臂,下手臂及手掌的外形,令其座標組合名稱分別為arm1, arm2, palm,各組合之起點與終點分別為其連結點(注意:每人所做的應該不同,請勿抄襲)。
2. 寫出一程式函數function body(L1,L2,L3,theta1,theta2,theta3),令其繪出整個手臂的外型。其對應角度除第一個上手臂之水平角度為theta1 外,theta2為下手臂對上手臂的角度,theta3為手掌對下手臂之夾角,後二者反時針方向為正,順時針方向為負。其連桿連結角度關係如圖二。試就所撰寫之程式結構作一說明。
3. 試量自己的手臂尺寸作為輸入,當theta1=90度,theta2=-45度,theta3=-30度時,其位置如何。
4. 設theta1角度在-90度與-75度間變動,theta2在-45度至-35度間變動,而theta3則在-30度至-10度間變動。試將其變動區間分為十等分,模擬其動畫,並在部落格中顯示其動作。

圖一 人體手臂之相關位置圖

圖二 連桿與結間之角度關係

先建立兩程式
palm.m
linkage.m

palm.m:
function palm(A,th)
%P為手掌函式
%令xx為P之實部
%令yy為P之虛部
P = [1+2.5i;2.1+3.7i;3.9+4.6i;5.1+5.3i;5.8+5.5i;8.2+5i;11.4+5.6i;12.6+6i;...
12.7+5.3i;12.5+4.7i;12+4.2i;11.2+3.6i;10+3.1i;10.2+2.9i;18+3.1i;...
18.7+2.8i;18.9+2.1i;18.4+1.6i;19.5+1.7i;20+1.4i;20.1+0.6i;19.5+0.2i;18;...
18.5-0.5i;18.4-1.1i;18.1-1.4i;15-1.7i;15.4-2.3i;15.2-3i;...
14.4-3.4i;4.7-4.1i;3.5-3.9i;2.5-3.4i;-1.5i];
xx = real(2*P/3);
yy = imag(6*P/7);
x = xx*cos(th)-yy*sin(th)+A(1);
y = xx*sin(th)+yy*cos(th)+A(2);
line(x,y);
axis([-10 50 -40 50]);
title('Press Ctl-C to stop');

linkage.m:
function linkshape(A,B,d,f)
AB = (B(1)+j*B(2))-(A(1)+j*A(2));
D = abs(AB);
th = angle(AB);
t = linspace(pi/2,2.5*pi,200);
b_C = d*exp(j*t')/2;
s_C = b_C/2;
b_b_C = f*exp(j*t')/2;
s_s_C = b_b_C/2;
P = [s_C;b_C(1:100);D+b_b_C(101:200);D+s_s_C;D+b_b_C(200);b_C(1)];
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([-10 50 -40 50]);
title('Press Ctl-C to stop');

今令
d=手臂與肩膀接合處之寬度半徑
e=手肘的寬度半徑
f=手腕的寬度半徑
A點=起始座標
q1=theta1
q2=theta3
q3=theta3

執行程式
d = 6;
e = 4;
f = 2.5;
A = [0 40];
q1 = (pi/180)*linspace(-90,-75,10);
q2 = (pi/180)*linspace(-45,-35,10);
q3 = (pi/180)*linspace(-30,-10,10);
for i = 1:10
for j = 1:10
for k = 1:10
%B點座標之定位,且旋轉平移
%C點的座標定位
B = 30*[cos(q1(i)) sin(q1(i))+1];
C = 27*[cos(q2(j)) sin(q2(j))];
plot(0,40);
%將AB連桿做圖
%將BC連桿做圖
%將CD連桿做圖
linkage(A,B,d,f);drawnow;
linkage(B,C,d,e);drawnow;
palm(C,q3(k));drawnow;
%歸一化座標軸
axis([-10 50 -40 50]);
%設定動畫時間間隔
pause(0.00000001);
title('Press Ctl-C to stop');
end;
end;
end;
動畫:


5.2
1. 就人的手指頭關節而言,可以將其解析成為下列之三連桿。試參考第二章及第三章中利用連桿與旋轉結的觀念,分析一個手掌的指頭在同一平面上作移動的情形。請詳明分析過程中所可以涉及之假設。
2. 就你自己的手掌尺寸為輸入,並請繪出四根指頭(大姆指除外)所可能展示的極限位置。
3. 當一個棒球投手(例如王建民)將球用手投出時,其各手指之速度及加速度如何(請參考第三章最後一節dyad_draw之函式所得的結果,並與手指運動時作對照。


先建立兩程式
finger.m
linkage2.m

finger.m:
function finger(A,d,l,w)
%令q1角度為theta1
%令q2角度為theta2
%假令q3角度為theta3
q1 = (pi/180)*linspace(0,-75,10);
q2 = (pi/180)*linspace(0,-90,10);
q3 = (pi/180)*linspace(0,-100,10);
for i = 1:10
for j = 1:10
for k = 1:10
%B點座標之旋轉
%C點座標之旋轉再加上B點之座標
%D點座標之旋轉再加上A,B兩點之座標
B = l(1)*[cos(q1(i)) sin(q1(i))] + A;
C = l(2)*[cos(q1(i)+q2(j)) sin(q1(i)+q2(j))] + B;
D = l(3)*[cos(q1(i)+q2(j)+q3(k)) sin(q1(i)+q2(j)+q3(k))] + C;
plot(10,10);
%呼叫連桿以畫出連桿一
%呼叫連桿以畫出連桿二
%呼叫連桿以畫出連桿三
linkshape2(A,B,d(1),d(2),w); drawnow;
linkshape2(B,C,d(2),d(3),w); drawnow;
linkshape2(C,D,d(3),d(4),w); drawnow;
axis([-5 15 -8 5]);
%歸一化座標軸範圍
pause(0.00000025);
title('Press ctrl-C to stop')
end;
end;
end;

linkshape2.m:
function linkshape2(A,B,d,f,c)
AB = (B(1)+j*B(2))-(A(1)+j*A(2));
D = abs(AB);
th = angle(AB);
t = linspace(pi/2,2.5*pi,200);
b_C = d*exp(j*t')/2;
s_C = b_C/2;
b_b_C = f*exp(j*t')/2;
s_s_C = b_b_C/2;
P = [s_C;b_C(1:100);D+b_b_C(101:200);D+s_s_C;D+b_b_C(200);b_C(1)];
xx = real(P);
yy = imag(P);
x = xx*cos(th)-yy*sin(th)+A(1);
y = xx*sin(th)+yy*cos(th)+A(2);
if (c == 1)
line(x,y,'Color','r');
end;
if (c == 2)
line(x,y,'Color','g');
end;
if (c == 3)
line(x,y,'Color','b');
end;
if (c == 4)
line(x,y,'Color','k');
end;
title('Press ctrl-C to stop');
axis([-5 15 -8 5]);

畫出食指:
finger([2 0],[2.4 1.6 1.6 1],[5.5 3 2.5],1);
畫出中指:
finger([2.5 0],[3 2 1.8 1],[6 3.5 2.5],2);
畫出無名指:
finger([1.5 0],[2 1.8 1.6 1.2],[5.5 3.3 2.5],3);
畫出小姆指:
finger([1 0],[2 1.6 1.2 1],[5 2.5 2.2],4);

動畫(食指):


假設投球時球由手至投出歷經時間為0.6秒,其角度根據手指實際彎曲角度所設置
可得:
速度(cm/s) 加速度(cm/s^2)
食指 13.7395 21.5837
中指 13.8284 22.4690
無名指 12.7566 16.5353
小拇指 11.1980 17.6780

此為手指的速度以及加速度,是根據手指長短及彎曲角度推測而得

作業四(補)

4.1
以講義第二章之圖2.5之正三角形為例,試寫出matlab程式,分別就三個頂點作動態旋轉(正三角形之邊長L=(你的學號末二碼)+10)。

邊長L=33+10=43
以三角形形心為旋轉中心
則半徑為
R=(43/2)/sind(60)
=24.8261
再執行程式:
for t=0:1080
clf;
x2=24.8261*cosd(90+1*t);
y2=24.8261*sind(90+1*t);
x3=24.8261*cosd(210+1*t);
y3=24.8261*sind(210+1*t);
x1=24.8261*cosd(330+1*t);
y1=24.8261*sind(330+1*t);
line([x1 x2],[y1 y2]);
line([x2 x3],[y2 y3]);
line([x3 x1],[y3 y1]);
%line([0 x1],[0 y1]);-----圓心至端點連線(可有可無)
%line([0 x2],[0 y2]);-----圓心至端點連線(可有可無)
%line([0 x3],[0 y3]);-----圓心至端點連線(可有可無)
xlabel('x軸');
ylabel('y軸');
title('Hit Ctrl+C to stop');
axis([-35 35 -35 35]);
pause(0.00000000001);
end
動畫:


4.2
設一連桿長度為10cm,厚度為4cm,繞於原點旋轉,其另一端則以一條彈簧固定於(15,0)cm的位置,試利用matlab寫出一程式,並繪圖顯示出該桿迴轉一圈時之位置。

執行程式
for t=0:360
clf;
x=10*cosd(t);
y=10*sind(t);
linkshape([0 0],[x,y],4);
line([x 15],[y 0],'color','g','linewidth',4);
axis([-20 20 -20 20]);
pause(0.00000000001);
end
綠色線條為彈簧
圖示:

動畫:


4.3
有一四連桿,其ABCD四點之座標分別為A(0,0);B(3,4);C(13,4);D(10,0),其單位為cm,若AD為固定桿,AB為第二桿BC與CD分別為第三與第四桿,各桿厚度分別為2cm,3cm,1.5cm,2cm。試繪出其相關位置。
若AB為主動迴轉桿,則其每間隔30度間之對應位置會如何?

試繪出其相關位置。
可推之
LAB=5
LBC=10
LCD=5
LAD=10
執行程式
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);
axis([-7 17 -7 7]);
圖示:


若AB為主動迴轉桿,則其每間隔30度間之對應位置會如何?

執行程式
for th=0:30:360
bx=5*cosd(th);
by=5*sind(th);
cx=10+5*cosd(th);
cy=5*sind(th);
linkshape([0 0],[10,0],2);
linkshape([0 0],[bx,by],3);
linkshape([bx by],[cx,cy],1.5);
linkshape([cx cy],[10,0],2);
axis([-7 17 -7 7]);
end
圖示:

2007年6月8日 星期五

作業十三

13.1
試設計一組複式齒輪,使其轉速比為125(請說明思考步驟及結果)

1.決定組合數:
複式齒列可用串聯多個組合之方式達到整體轉速比。設計總是由最簡單的結構開始,由於每組之轉速比以維持在10以內為佳,超過此值時則需考慮增加齒輪組數。因此轉速比為125時必須用較多的組數才成達到目標。首先,將125開方,其值為11.180,仍然比10大,故使用兩組組合仍嫌不足,如將125開立方,其值為5,低於10甚多,故使用三組齒輪之組合。
2.
若能直接找到轉速比為5之齒輪組合時,應是最好的選擇,因為只要將這種組合串聯三組即可。
設驅動之小齒輪數最小為12齒(N1大於=12)*,則依序可以得到對應大齒輪之齒數如下:

N2=5x12=60
N2=5x13=65
N2=5x14=70
N2=5x15=75
...

3.大齒輪齒數必須為整數。
由上列之數值中,所得之N2皆為整數,計算誤差:

N1齒數:12, 計算:(60/12)^3=125, 誤差:(125-125)/125*100%=0%
N1齒數:13, 計算:(65/13)^3=125, 誤差:(125-125)/125*100%=0%
N1齒數:14, 計算:(70/14)^3=125, 誤差:(125-125)/125*100%=0%
N1齒數:15, 計算:(75/15)^3=125, 誤差:(125-125)/125*100%=0%
...

驅動齒輪之齒數 N1:12,13,14,15,.......
大齒輪齒數 N2:60,65,70,75,.......
轉速比 :皆為5
誤差 :皆為0%

結論:
因為誤差值皆為0%,且N2之齒數皆為整數,所以可從中取任一值為N1齒數

今可取:
N1=12,N2=12*5=60,則其齒數順序為12:60;12:60;12:60等三組。
N1=13,N2=12*5=60,則其齒數順序為13:65;13:65;13:65等三組。
N1=14,N2=12*5=60,則其齒數順序為14:70;14:70;14:70等三組。
N1=15,N2=12*5=60,則其齒數順序為12:75;15:75;15:75等三組。
...........
驅動齒輪之齒數 N1:12,13,14,15,.......
大齒輪齒數 N2:60,65,70,75,.......
轉速比 :皆為5

任選一結果
再將此結果之三組齒輪串聯即可得到轉速比為125之複式齒輪組
-------------------------------------------------------------Ans

(補充)
4.
由於大部份製造機械均需要正確的轉速比,以免產生脫序運動。這時硬要三組之轉速比均相等並不一定適當,有些時候,可以就總轉速比值之性質求得不同組合之轉速比。本題因各組誤差皆為0%,所以可令三組之轉速比均相等,但是假如會有誤差值時,如轉速比為180時,開立方值為5.646
N1=12,13,14,15...

N2=5.646x12=67.75
N2=5.646x13=73.40
N2=5.646x14=79.06
N2=5.646x15=84.69
......

N2最接近整數者為79.06,故選用轉速比79:14是最佳選擇,串聯三組此轉速比之組合應可得到總轉速比為 (79/14)3=179.68,但是其值與理想比值180之誤差會有0.2%,不如由其開立方值5.646之近似整數如6開始。兩組串聯可得比值為36:1,再由180除以36可以得最後組之轉速比為 5。則三組合之轉速比分別為6, 6, 5。若小齒輪為14齒,則其對應大齒輪分別為84, 84, 70。其齒數序為14:84,14:84,14:70。此處小齒輪採用14齒係因在壓力角25度時,可以防止內切的最小齒數

13.2
請指出本學期中你自己最感得意的一次作業(請說明其原因,且該作業必須在自己的部落格內)。

我最感得意的一次作業應該是作業七吧(點較舊的文章)
這怎麼說呢?乍看之下好像只有短短幾行,但這次作業確確實實是我花了10幾個小時2個晚上才作完,印象非常的深刻,而且其中的程式除了7.3取自於機動學講義,其他都是自己慢慢寫出來的,那時候就覺得很有成就感.
尤其是在做7.2時,除了翻查了動力學的公式寫求出速度,加速度的程式,還為了研究如何將7.2速度,加速度,時間之關係以立體座標顯示出來,而試了很多方法,跑了一堆奇奇怪怪的程式碼,最後終於把圖片跑出來的時後真的超感動的,唯一的缺憾可能就是還是跑不出別的顏色和標示標籤.
而在做7.1時,爲了決定到底使用line還是plot,如何連結座標矩陣及建立運用個別函數,也弄了很久,那時就在想:我到底是在學機動學還是matlab啊= =|,不過真的學到很多.

這學期機動學上下來,除了學機動學的內容外,還學會了matlab的使用,經歷第一次架設經營部落格,也開了新的網路空間(Youtube),學會了設置動畫,學會了如何用Camsudio,學會了html網頁語言大致的架構......等,很多實用的東西,令我受益良多.
非常感謝老師給予我這麼多學習的機會!

2007年5月31日 星期四

作業十二

12.1
本人5/31號曾全程來上課
12.2
徑節(Diametral pitch,為模數之倒數,單位為(齒/寸))Pd為8,即節徑(節圓直徑D)上每寸直徑所分配之齒數為8,齒數分別為30T與48T,其工作壓力角為20度,14.5或25度。
根據圖:

計算

==取壓力角為20度==
1.求其接觸線長度,與接觸比
接觸線長度:
已知
N1=30T
N2=48T
Pd=8
所以
D1=N1/Pd1=30/8=3.75,R1=1.875
D2=N2/Pd2=48/8=6,R2=3
齒冠
a1=1/Pd1=1/8=0.125=a2
由上圖可知
LAB=AB=AP+PB
=(AN-PN)+(BM-PM)
=((R2+a)^2-R2^2cos^2(20))^0.5-R2*sin(20)+((R1+a)^2-R1^2cos^2(20))^0.5-R1*sin(20)
=((3+0.125)^2-3^2*(cosd(20))^2)^0.5-3*sind(20)+((1.875+0.125)^2-1.875^2*(cosd(20))^2)^0.5-1.875*sind(20)
=0.6275------------------------------接觸線長度
接觸比Mc
建立程式
function [c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(pd,n2,n3, phi)
% 輸入:
% Pd:徑節;
% n2,n4:O1,O2之齒數;
% phi:壓力角, degrees
% 輸出:
% c_ratio, c_length:接觸比及接觸長度
% ad:齒冠
%   pc,pb:周節及基周節
%   d2, d3:兩齒輪節圓直徑
%  ag:接近角,退遠角,作用角
% [alpha2 beta2 theta2 alpha3 beta3 theta3]
d2g=pi/180;
pangle=phi*d2g;
cosx=cos(pangle);sinx=sin(pangle);
ad=1./pd;pc=pi./pd;
pb=pc.*cosx;
r2=n2./(2*pd);r3=n3./(2*pd);d2=2*r2;d3=2*r3;
rb2=r2.*cosx;rb3=r3.*cosx;
ax=sqrt((r3+ad).^2-(r3.*cosx).^2)-r3.*sinx;
xb=sqrt((r2+ad).^2-(r2.*cosx).^2)-r2.*sinx;
c_length=ax+xb;
c_ratio=c_length./pb;
ag1=[ax./rb2 xb./rb2 c_length./rb2]/d2g;
ag2=[ax./rb3 xb./rb3 c_length./rb3]/d2g;
ag=[ag1;ag2];
執行
[c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(8,30,48,20)
得
ans =1.7005
[c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(8,30,48,20)
c_ratio =1.7005
c_length =0.6275
ad =0.1250
pc =0.3927
pb =0.3690
d2 =3.7500
d3 =6
ag =
10.4850, 9.9211, 20.4061
6.5532, 6.2007, 12.7538
已知
Mc=LAB/Pb(接觸線長度/基周節)
=0.6275/0.3690
=1.7005
所以接觸比Mc=1.7005=ans---------------------------------接觸比
2.兩齒輪之節圓、基圓直徑各為如何?請列式計算其結果
~根據上題所求得之數值~
兩齒輪之節圓、基圓直徑各為
O1:
節圓直徑:3.75
基圓直徑:(R1-a2)*2=3.5
O2:
節圓直徑:6
基圓直徑:(R2-a1)*2=5.75
(計算過程在前一題)
3.此組齒輪是否會產生干涉現象?試列式證明之
令
R1=O1節圓半徑
R2=O2節圓半徑
壓力角=f
證明:
如果齒輪不產生干涉
則
1.MP大於MA
R1*sind(f)大於=((R2+a2)^2-R2^2*cosd(f)^2)^0.5-R2*sind(f)
R1*sind(f)大於=(a2+2*a2*R2+R2^2*sind(f)^2)^0.5-R2*sind(f)
整理得
(R1+R2)^2*sind(f)^2大於=a2^2+2*a2*R2+R2^2*sind(f)^2
(R1^2+2*R1*R2)*sind(f)^2大於=a2^2+2*a2*R2
令齒冠=a1=a2=1/Pd,Ri=Ni/(2*Pd),代入
得
N1*(N1+2*N2)*(sind(f))^2大於= 4(1+N2)
同理
2.NP大於BP
R2*sind(f)大於=((R1+a1)^2-R1^2*cosd(f)^2)^0.5-R1*sind(f)
簡化
(R2^2+2*R2*R1)*sind(f)^2大於=a1^2+2*a1*R1
N2*(N2+2*N1)*sind(f)^2大於=4(1+N1)
今令
N1=30
N2=48
壓力角=20
代入公式
N1*(N1+2*N2)*(sind(f))^2大於= 4(1+N2)
得
30*(30+2*48)*(sind(20))^2大於=4(1+48)----公式成立----無干涉發生
另外也可用程式isinterf.m檢驗
isinterf.m:
function [x]=isinterf(phi,N1,N2)
% phi:壓力角,in degrees
% N1,N2:兩齒輪之齒數
% x=0:無干涉; x=1:發生干涉
x=0;
sinx=sin(phi*pi/180);
if N2小於N1,nn=N1;N1=N2;N2=nn;end
if N1*(N1+2*N2)*sinx*sinx小於4*(1+N2), x=1;end
執行
isinterf(20,30,48)
得
ans = 0-------無干涉發生
所以此兩齒輪不發生干涉
4.可否利用draw_gear.m繪出其接合情形,並繪出其動畫效果。
接合情形
利用draw_gear.m
draw_gear.m:
function [coords]=draw_gear(Dp,N,phi,range,x0,y0)
% 輸入:
% Dp:徑節
% N: 齒輪齒數
% phi: 壓力角
% range: 繪圖角度範圍
% x0,y0: 圓心座標
[coord,theta,rp,rb]=tooth(Dp,N,phi);
coords=[];i=0;
while i小於range
coord1=rotate2D(coord,-i,x0,y0);
coords=[coords;coord1];
i=i+theta;
end
plot(coords(:,1),coords(:,2));hold on;
[coord]=bushing(rp/8,x0,y0);
plot(coord(:,1),coord(:,2),'b-');
[coord]=bushing(-rp,x0,y0);
plot(coord(:,1),coord(:,2),'r:');
[coord]=bushing(-rb,x0,y0);
plot(coord(:,1),coord(:,2),'b:');
axis equal;
將程式中的i分別改為
i=-90
i=90
在分別執行
draw_gear(8,30,20,90,0,0)
draw_gear(8,48,20,270,4.875,0)
可得咬合情形
圖示:

另外
用程式move2_gear.m(講義中有)繪出動畫效果
move2_gear(Dpitch,nn1,nn2,phi,omega1)
輸入:
Dpitch:節徑D
nn1,nn2: 兩齒輪之齒數
phi:壓力角
omega1: O1之角數度
執行move2_gear(8,30,48,20,10)
動畫:


==取壓力角為14.5度==
1.求其接觸線長度,與接觸比
2.兩齒輪之節圓、基圓直徑各為如何?請列式計算其結果
執行
[c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(8,30,48,14.5)
得
ans =2.0308
[c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(8,30,48,14.5)
c_ratio =2.0308
c_length =0.7721
ad =0.1250
pc =0.3927
pb =0.3802
d2 =3.7500
d3 =6
ag =
12.6898, 11.6797, 24.3695
7.9311, 7.2998, 15.2309
可知
接觸線長度:0.7721
接觸比:2.0308
O1:
節圓直徑:3.75
基圓直徑:(R1-a2)*2=3.5
O2:
節圓直徑:6
基圓直徑:(R2-a1)*2=5.75
3.此組齒輪是否會產生干涉現象?試證明之
執行
isinterf(14.5,30,48)
得
ans =0
所以無干涉發生
4.可否利用draw_gear.m繪出其接合情形,並繪出其動畫效果。
接合情形
圖示:

執行move2_gear(8,30,48,14.5,10)
動畫:


==取壓力角為25度==
1.求其接觸線長度,與接觸比
2.兩齒輪之節圓、基圓直徑各為如何?請列式計算其結果
執行
[c_ratio,c_length,ad,pc,pb,d2,d3,ag]=contact_ratio(8,30,48,25)
得
c_ratio =1.5028
c_length =0.5349
ad =0.1250
pc =0.3927
pb =0.3559
d2 =3.7500
d3 =6
ag =
9.1921, 8.8419, 18.0340
5.7450, 5.5262, 11.2712
可知
接觸線長度:0.5349
接觸比:1.5028
O1:
節圓直徑:3.75
基圓直徑:(R1-a2)*2=3.5
O2:
節圓直徑:6
基圓直徑:(R2-a1)*2=5.75
3.此組齒輪是否會產生干涉現象?試證明之
執行
isinterf(25,30,48)
得
ans = 0
所以無干涉發生
4.可否利用draw_gear.m繪出其接合情形,並繪出其動畫效果。
接合情形
圖示:

執行move2_gear(8,30,48,25,10)
動畫:


壓力角為20之解為主要說明及解答
另外補充壓力角分別為
14.5
25
的各項數值,圖片及動畫
如果無法看到圖片或動畫
請至我的部落格~~~~

2007年5月30日 星期三

作業11(改)

11.1本人本週(5/24)有來上課
11.2
某凸輪開始時先在0-100∘區間滯留,然後提升後在200至260∘區間滯留,其高度(衝程)為5公分,其餘l由260∘至360∘則為返程。升程採用等加速度運動,返程之運動型式自定。設刻度區間為10∘,試繪出其高度、速度及加速度與凸輪迴轉角度間之關係。
先設置一程式:plot_dwell.m
function plot_dwell(ctheta,s,pattern,range)
figure(1);clf;
[y,yy,yyy]=dwell(ctheta,range,pattern)
h1=plot(ctheta,y*s,'b-',ctheta,yy*s,'k-',ctheta,yyy*s,'r-')
legend('Displacement','Velocity','Acceleration',3)
xlabel('Elapsed Angle, degrees')
grid
執行
plot_dwell(0:10:360,5,[2 1],[100 200 260]);
升程:等加速運動
回程:等速運動
圖示:

11.3
設凸輪之半徑為15公分,以順時針方向旋轉,其從動件為梢型,垂直接觸,長為10公分,從動件之運動係依照第二項之運動型式。試繪出此凸輪之工作曲線。
先設置一程式:P8_11.m
function [theta,y]=P8_11(theta,limit0,s)
d2r=pi/180;
h=s;lm=limit0*d2r;
lm=[lm(1) (lm(1)+lm(2))/2 lm(2) lm(3) (lm(3)+lm(4))/2 lm(4)]/d2r;
LM=lm*d2r;
th=theta*d2r;
y=ones(size(th));
y(thy(th>=LM(3))=h;
y(th>=LM(1)&th=LM(1)&thy(th>=LM(2)&th=LM(2)&thy(th>=LM(4)&th=LM(4)&thy(th>=LM(5)&th<=LM(6))=2*h*(1-(th(th>=LM(5)&th<=LM(6))-LM(4))/(LM(6)-LM(4))).^2;
plot(th/d2r,y);
xlabel('Theta in degrees');
ylabel('Follower displacement');
grid on;
執行
P8_11([0:10:360],[100 200 260 360],10)
工作曲線圖示:

11.4
你能讓此凸輪迴轉嗎?
能
圖示:

2007年5月21日 星期一

作業十(改)

10.1
本人本週(5/17)有來上課
10.2
請思考速度與加速度的問題,當一桿以某特定點M等角速度迴轉時,其端點P之速度方向如何?其加速度方向如何?若該特定點M復以等速水平運動,則同一端點P之速度與加速度方向會變為如何?若M點同時也有加速度,則點P會有何變化?若以此推理四連桿的運動,則點P與Q之速度與加速度方向會與桿一(固定桿)之兩端點之關係如何?與我們前面的作業分析結果有無共通之處?(參看第六章之四連桿機構之運動分析)

計算:
角速度:x rad/s
角加速度=0 rad/s^2
Vp:端點速度
Ap:端點加速度
t:時間
r:桿長
i=(1,0,0),j=(0,1,0),k=(0,0,1)---皆為向量
端點速度:
Vp=xk*(r*cos(x*t)i+r*sin(x*t)j)-------角速度為x時之P點速度
端點加速度:
Ap=Apr-Apu
=0-x^2*(r*cos(x*t)i+r*sin(x*t)j)
=-x^2*(r*cos(x*t)i+r*sin(x*t)j)----角速度為x時之P點加速度
Apr:P點切線方向加速度
Apu:P點法線方向加速度
若M點速度:Vm=Vmi(M點以等速水平運動)
則
Vp=Vm+Vp/m
=Vmi+xk*(r*cos(x*t)i+r*sin(x*t)j)---M點以Vmi等速水平運動時之P點速度
Ap=Am+ak*Rp/m-x^2*Rp/m
=0+0-x^2*(r*cos(x*t)i+r*sin(x*t)j)--M點以Vmi等速水平運動時之P點加速度
Vm:M點速度
Vp/m:P點相對於M點之速度
Rp/m:P點相對於M點之距離向量
若M點加速度:Am=Ami+Am'j----Ami,Amj為Am之兩分量
則
Vp=Vm+Vp/m
=Vmi+xk*(r*cos(x*t)i+r*sin(x*t)j)---M點同時有加速度之P點速度
Ap=Am+ak*Rp/m-x^2*Rp/m
=Ami+Amj+0-x^2*(r*cos(x*t)i+r*sin(x*t)j)
=(Am-x^2*r*cos(x*t))i+(Am'-x^2*r*sin(x*t))j---M點同時有加速度之P點加速度
Vm:M點速度
Vp/m:P點相對於M點之速度
Rp/m:P點相對於M點之距離向量
推測四連桿的運動,點P與Q之速度與加速度方向與桿一(固定桿)之兩端點之關係
假設:
桿1連桿2處為O,桿2連桿3處為P
桿1連桿4處為R,桿3連桿4處為Q
P點速度:Vp,Q點速度:Vq,4桿長度=[L1,L2,L3,L4]
4桿角速度=[w1,w2,w3,w4],4桿角加速度=[a1,a2,a3,a4],相對距離=D
則Vp=Vo+Vp/o=Vr+Vp/r
Vq=Vo+Vq/o=Vr+Vq/r
Ap=Ao+a2k*L2p/o-w2^2*L2p/o或
=Ar-a1k*L1o/r-w1^2*L1o/r+a2k*L2p/o-w2^2*L2p/o
Aq=Ar+a4k*L4q/r-w2^2*L4q/r或
=Ao+a1k*L1r/o-w1^2*L1r/o+a4k*L4q/r-w2^2*L4q/r
Vo:O點速度
Vp/o:P點相對於O點之速度
Vq:Q點速度
Vq/o:Q點相對於O點之速度
Vr:R點速度
Vp/r:P點相對於R點之速度
Vq/r:Q點相對於R點之速度
Ap:P點加速度
L2p/o:P點相對於O點距離為L2之向量
L1o/r:O點相對於R點距離為L1之向量
L4q/r:Q點相對於R點距離為L4之向量
L1r/o:R點相對於O點距離為L1之向量
都事先固定或確定其特定點(如O點)或特定桿(如桿1)之速度或加速度,再藉由各點(桿)間之相對速度及加速度,決定各點(桿)之絕對速度或加速度.與我們前面的作業分析結果有共通之處.
10.3
設有一運動之曲柄滑塊連桿組合,設滑塊之偏置量為零,且在水平方向移動,試以此機構之曲桿長度及角度,以及連結桿之長度為輸入項,利用matlab寫出一程式計算在不同曲柄角度時,六點瞬心之對應位置。可順便探討六點瞬心與曲柄角間之關係。

計算:
已知6點瞬心分別在3個連結點,垂直滑塊之無窮遠處,連結趕延伸線與過連結點1之垂直線相交處,及曲桿延伸線與垂直滑塊之延長線相交處.
令曲柄角度:th
曲柄長:L1
連結桿長:L2
瞬心位置分別為
1:(0,0)--連結點1
2:(L2*cos(th),L2*sin(th))--連結點2
th2=asin(L2*sin(th)/L3);
L=L2*cos(th)+L3*cos(th2);
3:(L,0)--連結點3
4:(0,L*tan(th2))--連結趕延伸線與過連結點1之垂直線相交處
5:(L,L*tan(th))--曲桿延伸線與垂直滑塊之延長線相交處
6:(L,無限遠)--垂直滑塊之無窮遠處

2007年5月6日 星期日

作業9(改)

本週(5/3)有來上課
請就教科書中第四章第五節之偏置機構作另類分析,分析過程可採你所知的方式(包括講義中所列的方法)。運動中分以曲桿驅動及滑塊驅動的方式,並說明運動的界限或範圍。設此機構之曲桿長Rcm , 連桿Lcm,滑塊之偏置量為10cm等數據作分析。其中,R=10+(學號末二碼),L=R+5 。

計算:
令桿2=R,桿3=L,滑塊水平距離=d,偏置量=e
依幾何關係建聯立方程式
R*sin(th2)+L*sin(th3)=e
R*cos(th2)+L*cos(th3)=d
可求出
th3=asin(e-R*sin(th2)/L)
th3'=asin(-e+R*sin(th2)/L)+pi
建立程式
function [d,theta3]=slider_solve(theta2,R,L,e,mode)
%theta2=桿2角度
%R=桿2長度 L=桿3長度
%e=偏置量 mode=決定theta3之角度
if nargin小於5, mode=0;end
d2g=pi/180;
theta=theta2*d2g;
cc=(e-R.*sin(theta))./L;
if mode大於=0,
theta3=asin(cc);
else
theta3=asin(-cc)+pi;
end
d=L.*cos(theta3)+R.*cos(theta);
theta3=theta3/d2g;
輸入桿2角度,R,L,e即可求出桿3角度和滑塊水平距離
---------------------------------------------
今令R=43,L=48,e=10
由幾何關係可知
theta2左極限出現在d=0時
右極限距離出現在R,L為直線時
右極限角度出現在e,L重疊時
左極限(d=0):
R*sin(th2)+L*sin(th3)=e
R*cos(th2)+L*cos(th3)=d
R=43,L=48,e=10,d=0
解聯立
theta2=204.3851
theta3=35.3229
圖示

右極限(d最遠):
theta2=asind(e/(R+L))=theta3
theta2=theta3=6.309
滑塊位置d=(R+L)*cosd(theta2)
=90.4489
圖示

右極限(角度)
Rsin(theta2)=-(L-e)
theta2=-62.94
theta3=90
圖示

所以
R=43,L=48,e=10:
theta2=6.309~204.3851-------角度限制
d=90.4489~0-----------------距離限制

2007年4月29日 星期日

作業八(改)

8A: 本人本週四(4/26)曾來上課
有一組四連桿,其桿長分別為r=[4 3 3 5],由桿2驅動,設第一固定桿角度theta1=0度; 角速度
td2=10rad/s; 角加速度tdd2=0 rad/s^2。

8B.1:
設桿2角度theta2=45度時,求各點之位置、速度與加速度為何?

先建立一程式
f4bar.m:
function [data,form]=f4bar(r,theta1,theta2,v2,a2,mode,linkdrive)
% This function analyzes a four-bar linkage when the driving link is
% crank(r2曲柄啟動) or coupler(r3聯結桿啟動). The input data are:theta1,theta2 are angles in degrees
% r=[r1 r2 r3 r4]= lengths of links(1=frame)
%v2 = crank or coupler angular velocity (rad/sec)
%a2 = crank or coupler angular acceleration (rad/sec^2)
%mode = +1 or -1. Identifies assembly(裝置) mode
%linkdrive = 0 for crank as driver; 1 for coupler as driver
%data (1:4,1)=link positions for 4 links
%data (1:4,2)=link angles in degrees
%data (1:4,3)=link angular velocities
%data (1:4,4)=link angular accelerations
%data (1,5)= velocity of point Q(r2端點)
%data (2,5)= velocity of point P(r3端點)
%data (3,5)= acceleration of point Q(r2端點)
%data (4,5)= acceleration of point P(r3端點)
%data (1,6)= position of Q(r2端點)
%data (2,6)= position of P(r3端點)
%form = assembly status. form = 0, mechanism fails to assemble.
if nargin<7,linkdrive=0;end
if nargin<6,mode=1;end
data=zeros(4,6);
% if coupler is the driver, interchange the vetor 3 & 2
if linkdrive==1,r=[r(1) r(3) r(2) r(4)];end
rr=r.*r;d2g=pi/180;
[theta,v,a]=deal(zeros(4,1));
theta(1:2)=[theta1 theta2]*d2g;
t1=theta(1);tx=theta(2);
s1=sin(t1);c1=cos(t1);
sx=sin(tx);cx=cos(tx);
% position calculations
A=2*r(1)*r(4)*c1-2*r(2)*r(4)*cx;
C=rr(1)+rr(2)+rr(4)-rr(3)-2*r(1)*r(2)*(c1*cx+s1*sx);
B=2*r(1)*r(4)*s1-2*r(2)*r(4)*sx;
pos=B*B-C*C+A*A;
if pos>=0,
form=1;
% Check for the denominator equal to zero
if abs(C-A)>=1e-5
t4=2*atan((-B+mode*sqrt(pos))/(C-A));
s4=sin(t4);c4=cos(t4);
t3=atan2((r(1)*s1+r(4)*s4-r(2)*sx),(r(1)*c1+r(4)*c4-r(2)*cx));
s3=sin(t3);c3=cos(t3);
else
% If the denominator is zero, compute theta(3) first
A=-2*r(1)*r(3)*c1+2*r(2)*r(3)*cx;
B=-2*r(1)*r(3)*s1+2*r(2)*r(3)*sx;
C=rr(1)+rr(2)+rr(3)-rr(4)-2*r(1)*r(2)*(c1*cx+s1*sx);
pos=B*B-C*C+A*A;
if pos>=0,
t3=2*atan((-B-mode*sqrt(pos))/(C-A));
s3=sin(t3); c3=cos(t3);
t4=atan2((-r(1)*s1+r(3)*s3+r(2)*sx),...
(-r(1)*c1+r(3)*c3+r(2)*cx));
s4=sin(t4);c4=cos(t4);
end
end
theta(3)=t3;theta(4)=t4;
%velocity calculation
v(2)=v2;
AM=[-r(3)*s3, r(4)*s4; -r(3)*c3, r(4)*c4];
BM=[r(2)*v(2)*sx;r(2)*v(2)*cx];
CM=AM\BM;
v(3)=CM(1);v(4)=CM(2);
%acceleration calculation
a(2)=a2;
BM=[r(2)*a(2)*sx+r(2)*v(2)*v(2)*cx+r(3)*v(3)*v(3)*c3-...
r(4)*v(4)*v(4)*c4;r(2)*a(2)*cx-r(2)*v(2)*v(2)*sx-...
r(3)*v(3)*v(3)*s3+r(4)*v(4)*v(4)*s4];
CM=AM\BM;
a(3)=CM(1);a(4)=CM(2);
%store results in array data
% coordinates of P and Q
if linkdrive==1,
c2=c3;c3=cx;s2=s3;s3=sx;
r(2:3)=[r(3) r(2)];theta(2:3)=[theta(3) theta(2)];
v(2:3)=[td(3) v(2)];a(2:3)=[a(3) a(2)];
else
c2=cx;s2=sx;
end
for j=1:4,
data(j,1:4)=[r(j)*exp(i*theta(j)) theta(j)/d2g v(j) a(j)] ;
end % position vectors
data(1,5)=r(2)*v(2)*exp(i*theta(2));%velocity for point Q
data(2,5)=r(4)*v(4)*exp(i*theta(4));%velocity for point P
data(3,5)=r(2)*(i*a(2)-v(2)*v(2))*exp(i*theta(2));%acc of Q
data(4,5)=r(4)*(i*a(4)-v(4)*v(4))*exp(i*theta(4));%acc of P
data(1,6)=data(2,1);%position of Q, again
data(2,6)=data(1,1)+data(4,1);% position of P
%find the accelerations
else
form=0;
if linkdrive==1,
r=[r(1) r(3) r(2) r(4)];
for j=1:4, data(j,1)=r(j).*exp(i*theta(j));end % positions
end
end
接著執行
[val,form]=f4bar([4 3 3 5],0,45,10,0,-1,0)
先求四桿之角度
abs(val(:,2))'
ans =
0 45.0000 69.4856 99.5246
以r1-r2接點為O,r2-r3:P,r3-r4:Q,r4-r1:R
r2x=3*cosd(45)
r2x=
2.1213
r2y=3*sind(45)
r2y=
2.1213
r3x=3*cosd(45)+3*cosd(69.4856)
r3x =
3.1726
r3y=3*sind(45)+3*sind(69.4856)
r3y=
4.9311

各端點位置:
O(0,0)
R(4,0)
P(r2x,r2y)=(2.1213,2.1213)
Q(r3x,r3y)=(3.1726,4.9311)
-------------------------------Ans

先求四桿之角速度
abs(val(:,3))'
ans =
0 10.0000 16.2681 4.9677

各端點速度:
VO=0
VP=3*10=30
VQ=5*4.9677=24.8385
VR=0
----------------------------Ans

先求四桿之角加速度
abs(val(:,4))'
ans =
0 0 491.4428 383.6120
ar=r''+r*(theta)^2
atheta=r*theta''+2*r'*theta'
A=(ar^2+atheta^2)^0.5
Par=3*(10)^2=300
Patheta=0
AP=300
Qar=5*(4.9677)^2=123.3902
Qatheta=5*383.6120=1.9181e+003
AQ=((123.3902)^2+(5*383.6120)^2)^0.5=1.9220e+003

各端點加速度:
AO=0
AP=300
AQ=1.9220e+003
AR=0
--------------------------Ans

8B.2
繪出此四連桿之相關位置及標明各點之速度方向及大小(以程式為之)。

先建立一程式:f4bar.m
再執行[val,form]=f4bar([4 3 3 5],0,45,10,0,-1,0);
q=1:4;
Vx(q)=abs(val(q,1)).*abs(val(q,3)).*sind(abs(val(q,2)));
Vy(q)=abs(val(q,1)).*abs(val(q,3)).*cosd(abs(val(q,2)));
求出
Vx(2)=21.2132
Vy(2)=21.2132
Vx(4)=24.4963
Vy(4)=-4.1101
再執行
r=[4 3 3 5];
th1=0;
th2=45;
mode=-1;
linkdrive=0;
r=[r(1) r(3) r(2) r(4)];
[values b]=f4bar(r,th1,th2,0,0,mode,linkdrive);
rr=values(:,1);
rr(3,1)=rr(1,1)+rr(4,1);
rx=real(rr(:,1));rx(4)=0;
ry=imag(rr(:,1));ry(4)=0;
if b==1
plot([0 rx(1)],[0 ry(1)],'k-','LineWidth',4);
hold on;
if linkdrive==0
plot([0 rx(2)],[0 ry(2)],'b-','LineWidth',1.5);
plot([rx(2) rx(3)],[ry(2) ry(3)],'r-','LineWidth',2);
else
plot([0 rx(2)],[0 ry(2)],'r-','LineWidth',2);
plot([rx(2) rx(3)],[ry(2) ry(3)],'b-','LineWidth',1.5);
end
plot([rx(1) rx(3)],[ry(1) ry(3)],'g-','LineWidth',1.5);
plot(rx,ry,'bo');
text(0,0,' O,V=(0,0)');text(rx(1),ry(1),' R,V=(0,0)');
text(rx(2),ry(2),' P,V=(21.2132,21.2132)');text(rx(3),ry(3),'Q,V=(24.4963,-4.1101)');
else
fprintf('Combination of links fail at degrees %6.1f\n',th2);
end
axis equal
grid on
圖示


8B.3
當桿2迴轉時,求出此組四連桿之限制角度,並繪出其位置(以程式為之)。

先建ㄧ程式:deadangle.m
deadangle.m:
function [theta]=deadangle(r,mode)
% Finding the max. and min. angles of link 4.
% Input: r: linkage matrix.
% Output:theta:angles of link 2 & link 4.
% Examples:
rr=r.*r;d2g=pi/180;if nargin<2,mode=1;end
ph1=acos(((r(2)-r(3))^2-rr(1)-rr(4))/(2*r(1)*r(4)));
ph2=acos(((r(2)+r(3))^2-rr(1)-rr(4))/(2*r(1)*r(4)));
th1=acos((rr(1)+rr(2)-(r(3)+r(4))^2)/(2*r(1)*r(2)));
th2=acos((rr(1)+rr(2)-(r(3)-r(4))^2)/(2*r(1)*r(2)));
if ~isreal(th1),th1=0;end
if ~isreal(th2),th2=2*pi;end
if th1>th2,temp=th1;th1=th2;th2=temp;end
if th1==pi&th2==2*pi,th1=0;end
if th1==0&th2==pi,th2=2*pi;end
if th1==0&th2==0,th2=2*pi;end
if ~isreal(ph1),ph1=0;end
if ~isreal(ph2),ph2=2*pi;end
if ph1>ph2,temp=ph1;ph1=ph2;ph2=temp;end
if ph1==0&ph2==0,ph2=2*pi;end
theta=[th1,th2;ph1,ph2]/d2g;
再執行
theta=deadangle([4 3 3 5])
得
theta =
0 28.9550
0 97.1808
得r2之限制角為28.9550
r4之限制角為97.1808
以閉合型及分支型區分
閉合型:

分支型:

8B.4
設theta2=[0:20:360],試繪出此組四連桿之重疊影像,解釋為何有些沒有值。

閉合型:

分支型:

有些沒有值是因為theta2已超過死點之角度,請看8B.3
8B.5
若將問題三考慮在內,只在可迴轉的範圍內迴轉,請問你能讓此組四連桿作成動畫方式迴轉嗎?

先建立一程式:drawlinkscg.m
drawlinkscg.m:
function [values]=drawlinks(r,th1,th2,mode,linkdrive)
if nargin<5,linkdrive=0;end
if nargin<4,mode=1;end
[values b]=f4bar(r,th1,th2,0,0,mode,linkdrive);
rr=values(:,1);
rr(3,1)=rr(1,1)+rr(4,1);
rx=real(rr(:,1));rx(4)=0;
ry=imag(rr(:,1));ry(4)=0;
if b==1
plot([0 rx(1)],[0 ry(1)],'k-','LineWidth',4);
hold on;
if linkdrive==0
plot([0 rx(2)],[0 ry(2)],'b-','LineWidth',1.5);
plot([rx(2) rx(3)],[ry(2) ry(3)],'r-','LineWidth',2);
else
plot([0 rx(2)],[0 ry(2)],'r-','LineWidth',2);
plot([rx(2) rx(3)],[ry(2) ry(3)],'b-','LineWidth',1.5);
end
plot([rx(1) rx(3)],[ry(1) ry(3)],'g-','LineWidth',1.5);
plot(rx,ry,'bo');
text(0,0,' O');text(rx(1),ry(1),' R');
text(rx(2),ry(2),' P');text(rx(3),ry(3),' Q');
else
fprintf('Combination of links fail at degrees %6.1f\n',th2);
end
title('Hit Ctrl+C to stop');
axis([-5 5 -5 5]);
grid on
閉合型:
執行
for t=1:5
for i=29:331
clf;drawlinkscg([4 3 3 5],0,i,-1,0);
pause(0.00000000001);
end;for i=29:331
clf;drawlinkscg([4 3 3 5],0,360-i,-1,0);
pause(0.00000000001);
end;
end
動畫

分支型:
for t=1:5
for i=29:331
clf;drawlinkscg([4 3 3 5],0,i,1,0);
pause(0.00000000001);
end;for i=29:331
clf;drawlinkscg([4 3 3 5],0,360-i,1,0);
pause(0.00000000001);
end;
end
動畫

2007年4月26日 星期四

作業6

6.1
圖示:

11個連桿,9個節點
可動度M=3(N-J-1)+segima fi i=1:J(2度空間)
所以M=3(11-9-1)+6(旋轉結*6)+4(複式結*2)+2(滑塊結*1)=15
可動度函數function[df]=gruebler(N,J)
code=[1 1 2 3 2 3 1 2 1 3 5];
n=length(J);
dim=3;if n>3,dim=6;end;
ff=0;njoint=0;
for i=1:n,
njoint=njoint+J(i);
ff=ff+J(i)*code(i);
end;
df=dim*(N-njoint-1)+ff;
執行
[df]=gruebler(11,[1 1 1 1 1 1 2 2 2])=8;
滑塊及滑梢的連結度皆為2和全為旋轉結之機構比較自由度差3
6.2
圖示:

球結:3
旋轉結=3*1=3
球結=3*3=9
M=6(5-6-1)+3*3+3*1=0(3度空間)可動
[df]=gruebler(5,[1 1 1 3 3 3])=-14
有惰性自由度
有2處連桿可自轉,故實際自由度應-2
6.3
葛拉索機構(4連桿)
1.曲柄搖桿機構
2.雙曲柄機構
3.雙搖桿機構
第一組:
S+G=P+Q
迴轉情況:應該有至少一桿為旋轉桿
第二組:
S+G大於P+Q(三搖桿機構)
迴轉情況:一搖桿固定,其二結點各延二圓移動,有的可完整旋轉一圈,有的則否.
第三組:
S+G小於P+Q(葛拉索型)
迴轉情況:ㄧ連桿固定,ㄧ結點完整旋轉,一結點圓弧移動.
函數檢驗
grashof.m:
function ans=grashof(ground,linkage)
link=sort(linkage);
ig=find(linkage==link(1));
if link(1)+link(4)大於link(3)+linf(2),
ans='Non-grashof linkage';
elseif link(1)+link(4)==link(3)+linf(2)
ans='Neutral linkage';
elseif link(1)==ground,
ans='Double-Grank linkage';
else
switch ig
case 1
im=3;
case 2
im=4;
case 3
im=1;
case 4
im=2;
end
if ground==linkage(im)
ans='Double-Rocker linkage';
else
ans='Rocker-Grank linkage';
end
end
執行
第一組:
grashof(4,[7 4 6 5])=Neutral linkage
第二組:
grashof(4,[8 3.6 5.1 4.1])= Non-grashof linkage
第三組:
grashof(4,[5.4 3.1 6.6 4.7])= Rocker-Grank linkage
令其s+g小於p+q即可成為葛拉索機構

作業7

本人(4/19)有上課
7.1
t=[1 2 3 4 5]
X1x(t)=33*cos(0.2*t);
X1y(t)=33*sin(0.2*t);
X2x(t)=33*cos(0.2*t)+38*cos(0.5+0.1*t);
X2y(t)=33*sin(0.2*t)+38*sin(0.5+0.1*t);
X3x(t)=33*cos(0.2*t)+38*cos(0.5+0.1*t)+28*cos(0.3+0.2*t);
X3y(t)=33*sin(0.2*t)+38*sin(0.5+0.1*t)+28*sin(0.3+0.2*t);
for i=1:5
line([0 X1x(i)],[0 X1y(i)]);
line([X1x(i) X2x(i)],[X1y(i) X2y(i)]);
line([X2x(i) X3x(i)],[X2y(i) X3y(i)]);
end
axis([0 100 0 100]);
grid on;
xlabel('x軸');
ylabel('y軸');
圖示:

7.2
t=1:5;
V1x=33*0.2*sin(0.2*t);
V1y=33*0.2*cos(0.2*t);
V2x=33*0.2*sin(0.2*t)+38*(0.5+0.1*t).*sin(0.5+0.1*t);
V2y=33*0.2*cos(0.2*t)+38*(0.5+0.1*t).*cos(0.5+0.1*t);
V3x=33*0.2*sin(0.2*t)+38*(0.5+0.1*t).*sin(0.5+0.1*t)+28*(0.3+0.2*t).*sin(0.3+0.2*t);
V3y=33*0.2*cos(0.2*t)+38*(0.5+0.1*t).*cos(0.5+0.1*t)+28*(0.3+0.2*t).*cos(0.3+0.2*t);
V1=(V1x.^2+V1y.^2).^0.5;
V2=(V2x.^2+V2y.^2).^0.5;
V3=(V3x.^2+V3y.^2).^0.5;
A1=0*t;
A2x=38*0.1*sin(0.5+0.1*t);
A2y=38*0.1*cos(0.5+0.1*t);
A3x=38*0.1*sin(0.5+0.1*t)+28*0.2*sin(0.3+0.2*t);
A3y=38*0.1*cos(0.5+0.1*t)+28*0.2*cos(0.3+0.2*t);
A2=(A2x.^2+A2y.^2).^0.5;
A3=(A3x.^2+A3y.^2).^0.5;
plot3(A1',V1',t');hold on;
plot3(A2',V2',t');hold on;
plot3(A3',V3',t');
axis([-10 50 -10 100 0 6]);
grid on;
xlabel('加速度');
ylabel('速度');
zlabel('時間');
圖示:

7.3
先建立函數
linkxy.m
linkrobot.m

linkxy.m:
function [x,y]=linkxy(A,B,d)
if nargin==2,d=1;end;
d=abs(d);
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 d>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);

linkrobot.m:
function link_robot(lens,angle,omega,a)
lens:手臂長
angle:起始角度
omega:角速度,rad/s
a;角加速度
time:[stop delt]
if nargin<4,w=1;end
if nargin<3,omega=1;end;
lens=lens(:);angle=angle(:);omega=omega(:);a=a(:);
if length(omega)==1,
omega=ones(size(lens))*omega;
end
t=0;nn=length(lens);clf;
for i=1:nn,
h(i)=line('xdata',[],'ydata',[],'erasemode','xor');
end
mm=sum(lens)-min(lens);
axis([-mm mm -mm mm]);axis equal;axis off;
title('Hit ctr-C to stop');
while 1
th=cumsum(angle+(omega+a*t)*t)*pi/180;
x=[0;cumsum(lens.*cos(th))];
y=[0;cumsum(lens.*sin(th))];
for i=1:nn
[xi,yi]=linkxy([x(i) y(i)],[x(i+1) y(i+1)],5);
set(h(i),'xdata',xi,'ydata',yi);
end
drawnow;
pause(0.1)
t=t+1;if t>1000,t=0;end
end

再執行
linkrobot([33 38 28],[0 0 0],[0.2 0.4 0.3],[0 0.1 0.2])
*各桿之對應長度=[33 38 28]
*各桿之對應起始角度=[0, 0, 0]
*各桿之對應角速度為=[0.2,0.5,0.3]rad/s
*各桿之對應角加速度為=[0,0.1,0.2]rad/s^2
動畫: