2007年4月18日 星期三

第五題

b94611021 張淳皓

5.1.1
手臂外形
arm1=[0 0;L1/2 -ld1/2;L1 0;L1/2 ld1/2;0 0;L1 0]
arm2=[0 0;L2/2 -ld2/2;L2 0;L2/2 ld2/2;0 0;L2 0]
palm=[0 0;0 -ld3;L3 -ld3;L3 0;ld3 0;ld3 ld3;0 ld3;0 0]
圖片

5.1.2
%程式內容
%theta1~3單位為degree
function body(L1,L2,L3,theta1,theta2,theta3)

%ld1~3分別為手臂及手掌的寬度
ld1=L1/3
ld2=L2/3
ld3=L3/5

%建立手臂及手掌的矩陣
arm1=[0 0;L1/2 -ld1/2;L1 0;L1/2 ld1/2;0 0;L1 0]
arm2=[0 0;L2/2 -ld2/2;L2 0;L2/2 ld2/2;0 0;L2 0]
palm=[0 0;0 -ld3;L3 -ld3;L3 0;ld3 0;ld3 ld3;0 ld3;0 0]

%清空圖片準備畫圖
clf
axis equal

%上臂之旋轉 紅色
m1=arm1(:,1)*cosd(-theta1)-arm1(:,2)*sind(-theta1)
n1=arm1(:,1)*sind(-theta1)+arm1(:,2)*cosd(-theta1)
patch(m1,n1,'r')

%下臂之旋轉 藍色
theta2=180+theta1-theta2
m2=arm2(:,1)*cosd(-theta2)-arm2(:,2)*sind(-theta2)+m1(3)
n2=arm2(:,1)*sind(-theta2)+arm2(:,2)*cosd(-theta2)+n1(3)
patch(m2,n2,'b')

%手掌旋轉 綠色
theta3=180+theta2-theta3
m3=palm(:,1)*cosd(-theta3)-palm(:,2)*sind(-theta3)+m2(3)
n3=palm(:,1)*sind(-theta3)+palm(:,2)*cosd(-theta3)+n2(3)
patch(m3,n3,'g')

5.1.3
圖片

5.1.4
動畫程式
動畫

5.2.1
  若將手指連接手掌的指節稱為第一指節,指間之指節稱為第三指節,則第三與第二指節為只能旋轉90度的旋轉節,第一指節在與第二、三指節同方向上亦有90度的限制,然而其可視為一球形關節,故第一指節在垂直於第二、三指節的方向上亦可做小角度的轉動。
  套用自由度計算,可將手掌視為接地端,手掌為第一桿,指節分別為第二、第三、四桿,總桿數為四,若只考慮第二、三指節的旋轉平面,則第一指節可視為一2d的旋轉節,故共有三個節,節之自由度總和為1+1+1=3
 則 M=3(N-J-1)+sum(f)=3(4-3-1)+3=3 自由度為三,可由三個指節分別作驅動桿

5.2.2
 在此我將body函式燒為改寫為繪製finger的函式
function finger(L1,L2,L3,theta1,theta2,theta3)

arm1=[0 0;L1/2 -L3/2;L1 0;L1/2 L3/2;0 0;L1 0]
arm2=[0 0;L2/2 -L3/2;L2 0;L2/2 L3/2;0 0;L2 0]
palm=[0 0;L3/2 -L3/2;L3 0;L3/2 L3/2;0 0;L3 0]
axis equal
m1=arm1(:,1)*cosd(-theta1)-arm1(:,2)*sind(-theta1)
n1=arm1(:,1)*sind(-theta1)+arm1(:,2)*cosd(-theta1)
patch(m1,n1,'r')
theta2=180+theta1-theta2
m2=arm2(:,1)*cosd(-theta2)-arm2(:,2)*sind(-theta2)+m1(3)
n2=arm2(:,1)*sind(-theta2)+arm2(:,2)*cosd(-theta2)+n1(3)
patch(m2,n2,'b')
theta3=180+theta2-theta3
m3=palm(:,1)*cosd(-theta3)-palm(:,2)*sind(-theta3)+m2(3)
n3=palm(:,1)*sind(-theta3)+palm(:,2)*cosd(-theta3)+n2(3)
patch(m3,n3,'g')

 再由呼叫finger函式分別繪製
小指

patch([0,-8,-8,0,0],[0 0 2 2 0],'r')
%此為繪製手掌
a=linspace(0,90,10)
b=linspace(180,90,10)
c=linspace(180,90,10)
for n=1:10
finger(5,3,2.7,a(n),b(n),c(n))
end

無名指

patch([0,-8,-8,0,0],[0 0 2 2 0],'r')
%此為繪製手掌
a=linspace(0,90,10)
b=linspace(180,90,10)
c=linspace(180,90,10)
for n=1:10
finger(5.5,3.5,3,a(n),b(n),c(n))
end

中指

patch([0,-8,-8,0,0],[0 0 2 2 0],'r')
%此為繪製手掌
a=linspace(0,90,10)
b=linspace(180,90,10)
c=linspace(180,90,10)
for n=1:10
finger(6,3.8,3,a(n),b(n),c(n))
end

食指
patch([0,-8,-8,0,0],[0 0 2 2 0],'r')
%此為繪製手掌
a=linspace(0,90,10)
b=linspace(180,90,10)
c=linspace(180,90,10)
for n=1:10
finger(5.5,3.5,2.8,a(n),b(n),c(n))
end


5.2.3
 由於得不到確切的球員指長數據,在此我以自己的指長做代表,假若我能投出時速90裡的棒球,那我的手指尖在球投出的瞬間至少與球等速,同為90裡的時速
 並假設投球過程中為等加速度運動,,整組投球動作歷時0.8秒

 則各手指之速度與加速度為

    速度  角速度  角加速度
食指  4kcm/s 354rad/s 443rad/s2
中指  4kcm/s 313rad/s 391rad/s2
無名指 4kcm/s 333rad/s 416rad/s2
小指  4kcm/s 374rad/s 468rad/s2

此組數據是以手指對地之速度得來,未捨去手臂帶動之速度與加速度

第四題

作業四 b94611021 張淳皓

4.1
以下為程式碼:

% 學號b94611021
%三角形邊長31
axis equal
AXIS([-55 55 -35 60])
length=21+10
x=[length/2 0 -1*length/2 length/2]
y=[0 (3)^(1/2)*length/2 0 0]

%將三角形存於handle "pic"
pic=line(x',y')

%利用迴圈及rotate指令處理動畫旋轉
for n=1:120
rotate(pic,[0 0 1],3,[length/2 0 0])
pause(0.003)
end
for n=1:120
rotate(pic,[0 0 1],3,[0 (3)^(1/2)*length/2 0])
pause(0.003)
end
for n=1:120
rotate(pic,[0 0 1],3,[-1*length/2 0 0])
pause(0.003)
end

4.2

以下為程式碼

%當連桿繞原點轉動
%設其另一端點為(x,y)
%彈簧為紅色粗線
clf
x=[0 10]
y=[0 0]
hold on
for n=1:12

m= x*cosd(30*n)-y*sind(30*n)
k= x*sind(30*n)+y*cosd(30*n)
linkshape([m(1) k(1)],[m(2) k(2)],4)
AXIS([-15 20 -15 15])
line([m(2) 15],[k(2) 0],'Color','r','LineWidth',2)
end

圖片

4.3

(1)繪出連桿位置
以下為程式:
%繪出連桿A(0,0);B(3,4);C(13,4);D(10,0)
%
a=[0 0]
b=[3 4]
c=[13 4]
d=[10 0]
linkshape(a,b,1)
linkshape(b,c,1.5)
linkshape(c,d,2)
linkshape(a,d,2)
圖片

(2)繪出移動圖示
以下為程式:

clf
hold on

a=[0 0]
b=[3 4]
c=[13 4]
d=[10 0]
linkshape(a,d,1)
for n=1:12
bx= b(1)*cosd(30*n)-b(2)*sind(30*n)
by= b(1)*sind(30*n)+b(2)*cosd(30*n)
cx=bx+10
cy=by
linkshape([10 0],[cx cy],1.5)
linkshape([bx by],[cx cy],2)
linkshape([0 0],[bx by],2)
pause(0.2)
end

圖片

新增的部份
程式為修改原four_link3而來 將程式中line函式轉為linkshape函式
function four_link3(theta2,r,mode)
% figure4.11 drawing program
%Inputs:
% theata2:links to display in link 2 degrees
% r:row matrix for link lengths={r1 r2 r3 r4]
% mode:+1/-1 for toggling position
% Example:
% four_link3([60],[4 2 4.2 2.6],1)
% Author: DSFon, BIME, NTU, Date:Feb 4,2007.
%

圖片">

第三次作業

b94611021 張淳皓

題3-1

(a)
%在此題中 我假定頭為原點 手臂以頭為固定結
%其中 肘關節之座標為(Xb,Yb) 拳頭座標為(0,Ya)
%後臂長35CM,前臂長30CM
Ya=10:5:65;
degree=(35^2.+Ya.^2-30^2)./(70.*Ya);
degree=acos(degree);
Xb=35*sin(degree);
Yb=35*cos(degree);
plot(Xb,Yb,'o');
hold on;
plot(0,Ya,'o')
title('後臂長35,前臂長30');
grid on;

軌跡圖片
藍線為手肘之軌跡 Y軸上之圓圈線為拳頭之軌跡

(b)
自己拳頭在以軀幹軸為正方向做線性移動的最大範圍為65CM
正好為手臂全長

(c)
在本題中 對於MATLAB繪圖做出以下假設
(1)手腕不為可動結點
事實上,手腕是可動的關節
(2)肩膀與頭都在原點位置
應有一段水平位移
(3)手肘關節可在0~180度任意屈伸
現實狀況中,手肘不可能完全夾緊至0度
(4)作為機動學上的分析,此系統將肩膀視為
一R形結,肘關節亦視為R形結,拳頭則類
似於限制在Y軸上的滑動結,其系統自由度
  為1

題3-2
(1)旋轉對
為平面低對之一種,又稱R-型對,應用如門閂、軸承等僅做迴轉而無平移的地方,其自由度為一
實例:
宿舍衣櫃的門軸
(2)高對與低對運動結
高對與低對的區分為運動節上兩物件的接觸狀況,高對通常僅接觸於一點或一線,例如辦公椅的輪子,就是輪子與地面僅有一條線的接觸高對,低對的兩物件通常皆處於面甚至多面,其接觸應力較小,例如前述的宿舍衣櫃的門軸
(3)型式閉合結或外力閉合結
Form-closed型式閉合結:
利用運動節的形狀限制另一桿之運動範圍,例如長號的伸縮管
Force-closed外力閉合結:
藉由外在之力,使兩桿維持接觸狀態,例如凸輪軸

參考資料 機動學 逢丁樹教授著

題3-3
(1)
假設此外接圓為以此人的半身高為長度所做出的五條以圓心作等距輻射的外接圓
此圖以我自己的身高165CM做輸入繪成
PIC
(2)
此圓的大小應與人的身高與手臂成正比關係

程式如下(此函數名稱為 drawhuman)
%初次的matlab函數寫作 中間用了很多dummy變數 尚待改正

function P=drawhuman
message='請輸入身高(CM)';
hight=input(message);
hight;
clf
hold on;
k=hight/(2^(1/2));
M=[0 0];
N=[k k];
degree=1;
for m=0:12
temp2=hight*pi*m/12;
for n=1:5
temp1(1)=N(1)*cosd(63-n*72-30*m)+N(2)*sind(63-n*72-30*m);
temp1(2)=(-1)*N(1)*cosd(63-n*72-30*m)+N(2)*sind(63-n*72-30*m);
temp1(1)=temp1(1)+hight*pi*m/12;
P=line([temp2,temp1(1)],[0,temp1(2)]);
end

l=0:pi/20:2*pi;
y=hight*(sin(l)+pi*m/12+i*cos(l));
plot(y);

end
title('b94611021(身高165CM)');
xlabel('移動距離(CM)');
ylabel('Y');
grid on;
axis equal