2007年5月9日 星期三

機動學第八次作業

本人(4/26)曾來上課。
8-1
利用f4bar程式

function [data,form] = f4bar(r,theta1,theta2,td2,tdd2,mode,linkdrive)
%
%function [data,form] = f4bar(r,theta1,theta2,td2,tdd2,mode,linkdrive)
% This function analyzes a four-bar linkage when the crank is the
% driving link. The input data are:
% theta1,theta2 are angles in degrees
% r=[r1 r2 r3 r4]= lengths of links(1=frame)
%td2 = crank or coupler angular velocity (rad/sec)
%tdd2 = 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
%data (2,5) = velocity of point P
%data (3,5) = acceleration of point Q
%data (4,5) = acceleration of point P
%data (1,6) = position of Q
%data (2,6) = position of P
%form = assembly status. form = 0, mechanism fails to
% assemble.
% program revised from Waldron's Textbook
% Revised:DSFON, BIME, NTU. Date: Feb. 7, 2007
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,td,tdd]=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
td(2)=td2;
AM=[-r(3)*s3, r(4)*s4; -r(3)*c3, r(4)*c4];
BM=[r(2)*td(2)*sx;r(2)*td(2)*cx];
CM=AM\BM;
td(3)=CM(1);td(4)=CM(2);

%acceleration calculation

tdd(2)=tdd2;
BM=[r(2)*tdd(2)*sx+r(2)*td(2)*td(2)*cx+r(3)*td(3)*td(3)*c3-...
r(4)*td(4)*td(4)*c4;r(2)*tdd(2)*cx-r(2)*td(2)*td(2)*sx-...
r(3)*td(3)*td(3)*s3+r(4)*td(4)*td(4)*s4];
CM=AM\BM;
tdd(3)=CM(1);tdd(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)];
td(2:3)=[td(3) td(2)];tdd(2:3)=[tdd(3) tdd(2)];
else
c2=cx;s2=sx;
end
for j=1:4,
data(j,1:4)=[r(j)*exp(i*theta(j)) theta(j)/d2g td(j) tdd(j)] ;
end % position vectors
data(1,5)=r(2)*td(2)*exp(i*theta(2));%velocity for point Q
data(2,5)=r(4)*td(4)*exp(i*theta(4));%velocity for point P
data(3,5)=r(2)*(i*tdd(2)-td(2)*td(2))*exp(i*theta(2));%acc of Q
data(4,5)=r(4)*(i*tdd(4)-td(4)*td(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)



位置       角速度     角加速度

I (0.0,0.0)       0        0
II (2.1,2.1)    10.0000        0
III (3.2,4.9)    16.2681     491.4428
IV (4.0,0.0)    4.9677     383.6120

8-2
利用drawlinks程式為之
此程式有利用到f4bar的值
所以在程式中只要設定好桿長以及角度
再加上模式與驅動桿的設定,就可以完成

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
axis equal
grid on




8-3
利用drawlimits程式
function drawlimits(r,th1,sigma,driver)
[Qstart, Qstop]=fb_angle_limits(r,th1,driver)
clf;
[values b]=f4bar(r,th1,Qstart,0,0,sigma,driver);
rr=values(:,1);
rr(3)=rr(1)+rr(4);
rx=real(rr);rx(4)=0;
ry=imag(rr);ry(4)=0;
if b==1
plot([0 rx(1)],[0 ry(1)],'k-','LineWidth',4);
hold on;
if driver==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');
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');
text(rx(2)/2,ry(2)/2,['s1=' num2str(Qstart,'%6.1f')]);
else
fprintf('Combination of links fails at degrees %6.1f\n',Qstart);
end
[values b]=f4bar(r,th1,Qstop,0,0,sigma,driver);
rr=values(:,1);
rr(3)=rr(1)+rr(4);
rx=real(rr);rx(4)=0;
ry=imag(rr);ry(4)=0;
if b==1
if driver==0
plot([0 rx(2)],[0 ry(2)],'b-','LineWidth',1);
plot([rx(2) rx(3)],[ry(2) ry(3)],'r-','LineWidth',1.5);
else
plot([0 rx(2)],[0 ry(2)],'r-','LineWidth',1.5);
plot([rx(2) rx(3)],[ry(2) ry(3)],'b-','LineWidth',1);
end
plot([rx(1) rx(3)],[ry(1) ry(3)],'g-');
plot(rx,ry,'bo');
text(rx(2),ry(2),' p');text(rx(3),ry(3),' q');
text(rx(2)/2,ry(2)/2,[' s2=' num2str(Qstop,'%6.1f')]);
else
fprintf('Combination of links fail at degrees %6.1f\n',Qstop);
end
axis equal
grid on

輸入drawlimits([4 3 3 5],0,1,0)

Qstart = 28.9550


Qstop = 331.0450


如圖所示



8-4
for i=0:20:360
drawlinks([4 3 3 5],0,i,-1,0);
pause(1)
end
Combination of links fail at degrees 0.0
Combination of links fail at degrees 20.0
Combination of links fail at degrees 340.0
Combination of links fail at degrees 360.0

我們會發現在某些角度譬如說20,340,360等沒有值
因為在旋轉四連桿的過程中,必須符合葛拉索定理
其實也就是連桿之間要構成封閉三角形的樣子
如果沒有構成封閉三角刑,那麼四連桿當然無法運作

r1 + r2 < r3 +r4
|r1 -r2|>|r3 - r4|

如下圖




8-5
利用網頁上講義的程式move_4paths
此程式必須用到相當多其他的子程式
例如f4bar.m funcion, f4limits.m, fb_angle_limits.m
等等,可以說是一個整合的結果
function move_4paths(r,r6,th6,nlink,th1,td2,tdd2,sigma,driver,ntimes,npts)
%
%function move_4paths(r,r6,th6,nlink,th1,td2,tdd2,sigma,driver,ntimes,npts)
%
%draw the positions of four-bar links
%call f4bar.m funcion, f4limits.m, fb_angle_limits.m, body.m
%
%Inputs:
% r: row vector for four links
% th1: frame angle
% th2: crank angle or couple angle
% td2,tdd2:angular velocity and acceleration of the driving link.
% sigma: assembly mode
% driver: 0 for crank, 1 for coupler
% ntimes: no. of cycles
% npts: number of points divided
% r6,rh6,nlink:additional length and angle for nlink link.
%example:
% move_4paths([4 2 3 4],2,-30,3,0,10,0,1,0,4,100)
%
%clf;
if nargin<10, ntimes=3;npts=100;end;
figure(1);
[Qstart, Qstop]=fb_angle_limits(r,th1,driver);
npoint=abs(npts);
th2=linspace(Qstart,Qstop,npoint);
val=zeros(6,npoint);
for i=1:npoint,
[vr b]=f4bar(r,th1,th2(i),td2,tdd2,sigma,driver);
[para]=body(r6,th6,vr,nlink);
val(1:3,i)=[vr(1,1);vr(2,1);vr(1,1)+vr(4,1)];
val(4:6,i)=[para(1);para(3);para(2)];
end
x=real(val);y=imag(val);
h=f4limits(r,th1,sigma,driver);
line(x(5,:)',y(5,:)','color','r','linestyle',':');
line(x(4,:)',y(4,:)','color','b','linestyle','-.');
line(x(6,:)',y(6,:)','color','k','linestyle',':');
range=1.2*([min(min(x)) max(max(x)) min(min(y)) max(max(y))]);
axis(range);axis equal;grid off;
for i=2:4,set(h(i),'erasemode','xor');end
h0=patch('xdata',[],'ydata',[],'erasemode','xor','facecolor','r',...
'marker','o');
i=0;s=-1;axis off;
for m=1:ntimes
s=-s;
if abs(Qstop-Qstart-360)<1,i=0;s=1;end;
while 1,
i=i+s;
if i>npoint|i==0,break;end;
set(h(2),'xdata',[0 x(2,i)], 'ydata',[0 y(2,i)]);%crank
set(h(3),'xdata',[x(2,i) x(3,i)], 'ydata',[y(2,i) y(3,i)]);%coupler
set(h(4),'xdata',[x(1,i) x(3,i)], 'ydata',[y(1,i) y(3,i)]);%Rocker
set(h0,'xdata',[x(4:6,i)], 'ydata',[y(4:6,i)]);
drawnow; %flush the draw buffer
pause(0.1);
end
end % for m loop
function h=f4limits(r,th1,sigma,driver)
[Qstart, Qstop]=fb_angle_limits(r,th1,driver)
[values b]=f4bar(r,th1,Qstart,0,0,sigma,driver);
if b==1,
h=draw4link(values,driver);
else
fprintf('Combination of links fails at degrees %6.1f\n',Qstart);
end
[values b]=f4bar(r,th1,Qstop,0,0,sigma,driver);
if b==1,
h=draw4link(values,driver);
else
fprintf('Combination of links fails at degrees %6.1f\n',Qstart);
end
axis equal
grid on


輸入
move_4paths([4 3 3 5],0,45,3,0,0,0,1,0,4,100)

可得下面的影片

2007年4月25日 星期三

機動學第七次作業

本人(4/19)有上課

1&3

把動畫做出來即可看出每一秒
桿對應的位置

影片請參照網頁

影片

2

第一桿之速度

第二桿之速度


第三桿之速度



第一桿之加速度


第二桿之加速度


第三桿之加速度

2007年4月24日 星期二

機動學第六次作業

6.1

(i)
如圖所示,每個節根據課本3-8一桿多結之算法
總共有15個節,其中o是滑塊跟地面的滑動結
以及圖中紅色數字代表桿,共有12個桿


(ii)
根據課本公式(3.2)
M=3(N-J-1)+fi
N為桿數,在此為12
J為結數,在此為15
fi是運動節連結度的總合
fi=12*1+2*2+1*1=17
12個旋轉結,2個滑槽結,1個滑動結

綜合上述
M=3(12-15-1)+17=5 自由度=5

(iii)
利用網頁第四張講義的古魯伯公式
輸入gruebler(12,[12 1 2])
可得ans=5

(iv)
滑塊與地面形成一個滑動結,其自由度為一
  而滑槽因為有轉動和滑動的兩個自由度
  所以自由度為二

6.2

(i)
  同6.1紅色數字代表桿,藍色英文代表結
  a,b為旋轉結,自由度為1
  c,e,f為球結,自由度為3
  d為圓柱結,自由度為2


(ii)
  用課本公式(3.5)空間機構的自由度
m=6(N-J-1)+F
=6(6-6-1)+13=7
  所以自由度為7

(iii)
gruebler(6,[2 0 0 3 1])
跟6.1的過程很像
可得ans=7

(iv)
我們可以經過觀察發現
4桿和6桿都可以自轉,產生了所謂的惰性自由度
  所以總自由度=7-2=5

我們發現具有惰性自由度的桿在旋轉時並不影響
系統之外形,計算自由度的結果也跟實際上有差
異,所以我們應該避免設計出這樣的連桿


6.3

(i)第一組:7+4=5+6

屬於葛拉所型之特殊情況或是稱第三型,即最短桿加最長
桿會等於其餘兩桿之和

grashof(1,[7 4 6 5])
ans=Neutral Linkage
也就是中性桿

此時的連桿處於重疊位置,其運動往前或是後退是一種不
可預知的情況


(ii)第二組:8+3.6>5.1+4.1

參考課本公式(4.2),此類型屬於葛拉索第二型

grashof(1,[8 3.6 5.1 4.1])
ans=Non-Grashof Linkage

由函式可以看出也就是非葛拉所型,四連桿均屬於雙搖桿型
,因為任何桿皆無法產生完整的迴轉運動


(iii)
第三組:6.6+3.1<5.4+4.7

此類型屬於葛拉索第一型

grashof(1,[5.4 3.1 6.6 4.7])
ans=Crank-Rocker Linkage

上述三組連桿的(i)與(ii)不是葛拉索型如果要調
整成葛拉索型可以將最短桿+最長桿縮小,或是將
其餘兩桿伸長,已達成葛拉索型之定義

2007年4月10日 星期二

機動學第五次作業之二


function finger(L1,th1)


finger=[-L1/3 0;0 L1/6;L1 L1/6;L1*4/3 0;L1 -L1/6;0 -L1/6;-L1/3 0];
f=line(finger(:,1),finger(:,2));
rotate(f,[0 0 1],th1,[0 0 0]);

function finger2(L1,L2,th1,th2)
finger2=[ L1*cosd(th1)-L2*1/3 L1*sind(th1);
   L1*cosd(th1) L1*sind(th1)+L2*1/6;
   L1*cosd(th1)+L2 L1*sind(th1)+L2*1/6;
   L1*cosd(th1)+L2*4/3 L1*sind(th1);
L1*cosd(th1)+L2 L1*sind(th1)-L2*1/6;
L1*cosd(th1) L1*sind(th1)-L2*1/6;
L1*cosd(th1)-L2*1/3 L1*sind(th1)];
f2=line(finger2(:,1),finger2(:,2));
rotate(f2,[0 0 1],th1+th2,[L1*cosd(th1) L1*sind(th1) 0]);


function fingertip(L1,L2,L3,th1,th2,th3)
finger=[L1*cosd(th1)+L2*cosd(th1+th2)-L3*1/3 L1*sind(th1)+L2*sind(th1+th2);
L1*cosd(th1)+L2*cosd(th1+th2) L1*sind(th1)+L2*sind(th1+th2)+L3*1/6;
L1*cosd(th1)+L2*cosd(th1+th2)+L3 L1*sind(th1)+L2*sind(th1+th2+L3*1/6;
L1*cosd(th1)+L2*cosd(th1+th2)+L3*4/3 L1*sind(th1)+L2*sind(th1+th2);
L1*cosd(th1)+L2*cosd(th1+th2)+L3 L1*sind(th1)+L2*sind(th1+th2)-L3*1/6;
L1*cosd(th1)+L2*cosd(th1+th2) L1*sind(th1)+L2*sind(th1+th2)-L3*1/6;
L1*cosd(th1)+L2*cosd(th1+th2)-L3*1/3 L1*sind(th1)+L2*sind(th1+th2)];

f=line(finger(:,1),finger(:,2));
rotate(f,[0 0 1],th1+th2+th3, [L1*cosd(th1)+L2*cosd(th1+th2) L1*sind(th1)+L2*sind(th1+th2) 0]);

function body2(L1,L2,L3,th1,th2,th3)
finger(L1,th1);
finger2(L1,L2,th1,th2);
fingertip(L1,L2,L3,th1,th2,th3);

p5-2.3
以三根連桿大概表示出手指頭的三節,如何有最大的極限動作,
假設在座標原點(0,0)是手指固定的那一端我的假設是關節的部
分都是尖的,因為要畫出接近弧形的關節必須要描很多點,所以
在這裡我就用比較方正的畫法,可以減少描點的數量




p5-2.4

假設棒球選手的球速投出時有144km/h,換算成公制單位也就是40m/s,假設在投出的時候之速度就等於
手指向下的切線速度,那麼我們會發現向心加速度(假設手指大約10公分長)
a=v.v/r=40*40/0.1=16000m/s.s 這個加速度假如乘上質量(設手大約200克重)得到的結果
就有3200牛頓,大約接近300公斤的力,由這裡我們很明顯看出來棒球選手投球絕對不只有用到手指
,用手臂可以讓r變大,讓所承受的力變小,如果要再加上腰力或是腿的全身平衡就更複雜了,超出這次的範圍在這裡就不討論了

機動學第五次作業之一

p5-1.1

function arm1(L1,th1) %建立一個叫做arm1的函數
axis equal; %裡面有L1及th1分別代表上臂長和其轉動角度
for i=90:1:270 %大致上畫出肩膀的球窩關節
arm1upx=5*cosd(i); %量自己的手發現寬度的一半大約為五公分
arm1upy=5*sind(i);
arm1upx1=5*cosd(i)*cosd(-th1)-5*sind(i)*sind(-th1);
arm1upy1=5*cosd(i)*sind(-th1)+5*sind(i)*cosd(-th1);
line(arm1upx1,arm1upy1);
end;
for j=-90:1:90
arm1lowx=3*cosd(j)+L1; %這是手肘部分的關節
arm1lowy=3*sind(j); %與肩膀關節假設差不多,只是寬度不同
arm1lowx1=(3*cosd(j)+L1)*cosd(-th1)-3*sind(j)*sind(-th1);
arm1lowy1=(3*cosd(j)+L1)*sind(-th1)+3*sind(j)*cosd(-th1);
line(arm1lowx1,arm1lowy1);
end;
%分別寫出連接幾個點的
%X和Y座標,把手的部分
%跟上面關節的部分接起來
p1x=5*cosd(90)*cosd(-th1)-5*sind(90)*sind(-th1);
p1y=5*cosd(90)*sind(-th1)+5*sind(90)*cosd(-th1);
p2x=5*cosd(270)*cosd(-th1)-5*sind(270)*sind(-th1);
p2y=5*cosd(270)*sind(-th1)+5*sind(270)*cosd(-th1);
p3x=(3*cosd(-90)+L1)*cosd(-th1)-3*sind(-90)*sind(-th1);
p3y=(3*cosd(-90)+L1)*sind(-th1)+3*sind(-90)*cosd(-th1);
p4x=(3*cosd(90)+L1)*cosd(-th1)-3*sind(90)*sind(-th1);
p4y=(3*cosd(90)+L1)*sind(-th1)+3*sind(90)*cosd(-th1);

qua=[p1x p1y;p2x p2y;p3x p3y;p4x p4y;p1x p1y]; %一筆劃線
line(qua(:,1),qua(:,2));
function arm2(L1,L2,th1,th2) %這是下臂的函數
axis equal; %假設大致與上臂相同,比較不一樣的地方
for i=90:1:270 %在因為下臂必須跟手肘連接,所以要用到
arm2upx=3*cosd(i)+L1; %有關上臂的參數像L1,th1
arm2upy=3*sind(i);
arm2upx1=arm2upx*cosd(-th2)-arm2upy*sind(-th2);
arm2upy1=arm2upx*sind(-th2)+arm2upy*cosd(-th2);
line(arm2upx1,arm2upy1);%end;%for j=-90:1:90
arm2lowx=2*cosd(j)+L2+L1;
arm2lowy=2*sind(j);
arm2lowx1=arm2lowx*cosd(-th2)-arm2lowy*sind(-th2);
arm2lowy1=arm2lowx*sind(-th2)+arm2lowy*cosd(-th2);
line(arm2lowx1,arm2lowy1);
end;

p1x=(3*cosd(90)+L1)*cosd(-th1)-3*sind(90)*sind(-th1);
p1y=(3*cosd(90)+L1)*sind(-th1)+3*sind(90)*cosd(-th1);
p2x=(3*cosd(270)+L1)*cosd(-th1)-3*sind(270)*sind(-th1);
p2y=(3*cosd(270)+L1)*sind(-th1)+3*sind(270)*cosd(-th1);
p3x=(2.5*cosd(-90)+L2+L1)*cosd(-th1)-2.5*sind(-90)*sind(-th1);
p3y=(2.5*cosd(-90)+L2+L1)*sind(-th1)+2.5*sind(-90)*cosd(-th1);
p4x=(2.5*cosd(90)+L2+L1)*cosd(-th1)-2.5*sind(90)*sind(-th1);
p4y=(2.5*cosd(90)+L2+L1)*sind(-th1)+2.5*sind(90)*cosd(-th1);
qua=[p1x p1y;p2x p2y;p3x p3y;p4x p4y;p1x p1y];
%最後畫出下臂的外形

h=line(qua(:,1),qua(:,2));
rotate(h,[0 0 1],th2,[L1*cosd(-th1) L1*sind(-th1) 0])
%加了rotate就可以讓
%下臂繞著手肘旋轉

function palm(L1,L2,L3,th1,th2,th3) %手掌的函數
%手掌要跟下臂連接,所以起始點連接是
%手腕的部分
p1x=L1*cosd(-th1)+L2*cosd(-90+th2);
p1y=L1*sind(-th1)+L2*sind(-90+th2);
%大致上假設大拇指根部在1/3手掌長的地方
%其他描點大約都按照手掌比例而成
p2x=p1x+L3/3;
p2y=p1y;
p3x=p1x+2/3*L3;
p3y=p1y+L3/4;
p4x=p1x+L3/2;
p4y=p1y;
p5x=p1x+L3;
p5y=p1y;
p6x=p1x+L3;
p6y=p1y-1;
p7x=p1x+L3/2;
p7y=p1y-1;
p8x=p1x+L3/2;
p8y=p1y-1.3;
p9x=p1x+L3;
p9y=p1y-1.3;
p10x=p1x+L3;
p10y=p1y-2.3;
p11x=p1x+L3/2;
p11y=p1y-2.3;
p12x=p1x+L3/2;
p12y=p1y-2.6;
p13x=p1x+L3;
p13y=p1y-2.6;
p14x=p1x+L3;
p14y=p1y-3.6;
p15x=p1x+L3/2;
p15y=p1y-3.6;
p16x=p1x+L3/2;
p16y=p1y-3.9;
p17x=p1x+L3;
p17y=p1y-3.9;
p18x=p1x+L3;
p18y=p1y-5;
p19x=p1x;
p19y=p1y-5;
hand=[p1x p1y;p2x p2y;p3x p3y;p4x p4y;p5x p5y;p6x p6y;p7x p7y;p8x p8y;p9x p9y;p10x p10y;p11x p11y;p12x p12y;p13x p13y;p14x p14y;p15x p15y;p16x p16y;p17x p17y;p18x p18y;p19x p19y;p1x p1y];

h=line(hand(:,1),hand(:,2));
rotate(h,[0 0 1],th3,[p1x p1y 0])
%最後把線全部連起來
%同樣這個函數讓圖形旋轉
axis equal



p5-1.2

%一個body的函數要能畫出三部分,就要有對應的參數
%上臂只需要上臂長,自己旋轉的角度 下臂和手掌需要
%它們上面的function的參數,因為轉動會影響座標的變化
function body(L1,L2,L3,th1,th2,th3)
arm1(L1,th1);
arm2(L1,L2,th1,th2);
palm(L1,L2,L3,th1,th2,th3);

由於手掌及arm2的位置都會受到arm1的影響,所以其中所含有的變數必須包含前面的變數,例如L1,L2th1,th2等等



p5-1.3

由於手掌的角度不可能彎成作業平台上所示的-30度,所以我個人認為教授所敘述的應該是相對於arm2的30度,也就是以手往前延伸當作水平線來算,手掌往逆時針方向旋轉30度,如我認知錯誤,煩請教授指正


p5-1.4
我根據上一題的解釋,所畫出的人類手臂的轉動的模式


2007年3月27日 星期二

機動學第四次作業

p4-1

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;

2007年3月21日 星期三

機動學作業三

P3-1

for i=1:7;
L1=37;
L2=28;
head(i)=25+5*i;
thera=acosd((L2.^2+head(i).^2-L1.^2)./(2*L2*head(i)));
x=L2.*cosd(90-thera);
y=L2.*sind(90-thera);
triangle=[0 0;x y;0 head(i)];
line(triangle(:,1),triangle(:,2)) ;
end;




2.拳頭最多可以舉到頭頂正上方30cm,也就是i=7的時候。

3.假設拳頭為一個質點,而且拳頭和手肘與頭頂一值都在同一平面上,
 並且也忽略了肩膀的寬度



p3-2


1.旋轉對:例如門閂 、軸承,旋轉對也是一種平面低對。



   門閂       軸承


2.高對與低對運動結:例如平面對是一種低對,而滾珠則屬於高對。



     平面對                滾珠護圈


3.型式閉合結或外力閉合結:形式閉合結例如連桿組;外利閉合的例子則有凸輪系統

凸輪
連桿組
凸輪系統




p3-3


message=('輸入身高')

h=input(message);
r=h/2; %設半徑為身高之一半
circle=0:1:360;

for thera=0:12; %旋轉的角度

x0=thera*r*pi/6; %畫圓
x=r*sind(circle)+x0;
y=r*cosd(circle);

for body=[0 90 150 210 270 360]; %畫一個大字型(人)

x1=r*sind(body+thera*30)+x0; %人旋轉
y1=r*cosd(body+thera*30);

axis equal;
line([x0 x1'],[0 y1']); %畫出圓和人
hold on;
end;

line(x,y);

end;