2007年6月10日 星期日

機動學第十二次作業

一組標準全齒輪齒輪之徑節為8(亦可使用自設值),齒數分別為30T與48T,
其工作壓力角為20度(可為14.5或25度,自選)。

試求其接觸線長度,與接觸比。
我的工作壓力為20度
利用contact_ratio.m計算(在老師的講議中)
[c_ratio, c_length,ad,pc,pb,r2,r3,ag]=contact_ratio(8,30,48,14)

接觸比=1.7005
接觸長度=0.6275 吋
齒冠=0.125吋
周節pc=0.3927;基周節pb=0.3690
齒輪節圓直徑r2=3.75吋, r3=6吋
齒輪2之接近角=10.4850度;遠退角=9.9211度
作用角=20.4061度
齒輪3之接近角=6.5532度;遠退角=6.2007度
作用角=12.7538度

兩齒輪之節圓、基圓直徑各為如何?請列式計算其結果。
徑節為8 齒數分別為30T與48T 工作壓力角為20度

rp=N/徑節/2;
ra=rp+1/Pd;
cosx=cos(工作壓力);
rb=rp*cosx;

基圓直徑
cosx=cos(工作壓力);
Ld=d*cosx;

Ld1*cos20°=3.5238
Ld2*cos20°=5.6381

此組齒輪是否會產生干涉現象?試列式證明之。

測試干涉之條件為:

(N2²+2N2 x N3)sin²θ>= 4 + 4N3

壓力角=20°

30(30+2*48) sin²20°=442.176>4+4*48=196

function [x]=isinterf(phi,N1,N2)

isinterf(30,48,20)

ans =
0

工作角情況皆不會產生干涉


可否利用draw_gear.m繪出其接合情形,並繪出其動畫效果。


[coords]=draw_gear(8,30,20,0,360,0,0);
[coords]=draw_gear(8,48,20,180/48,360,9.75/2,0);



利用move2_gear.m製作動畫
move2_gear(8,30,48,20,10)

2007年5月30日 星期三

機動學第十一次作業

第十一次作業(Due date: 12pm May 30, 2007)

請聲明本週(5/24)有來上課。
本人有上本週的課


某凸輪開始時先在0-100∘區間滯留,然後提升後在200至260∘區間滯留,其高度(衝程)為5公分,
其餘l由260∘至360∘則為返程。升程採用等加速度運動,返程之運動型式自定。設刻度區間為10∘,
試繪出其高度、速度及加速度與凸輪迴轉角度間之關係。

下面plot_dwell.m為一執行Dwell函數之範例。其指令如下:

function plot_dwell(ctheta,s,pattern,range)
%ctheta = cam angle (deg)--can be a matrix
%pattern = denote the type of motion used(a 3 element-row matrix)
% 1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
% 5:polynomial motion
% example [4 3]
%range =the degrees the specific motion starts
% Output: y is for displacement, yy is the derivative of the displacement with
% respect to theta, and yyy the second derivative with respect % to theta.
% Example plot_dwell(0:10:360,2,[4 3],[90 180 240]);
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 2],[100 200 260])

dwell內的parabolicm函數有小錯誤
上面的程式是有修改過的

而結果如下





上面的圖可以看到(紅色圈圈),速度值為斜直線,但是加速度竟是斜直線(應該是水平直線)。這是因為我們取間隔10度做變化,於是連線變為斜直線。

如果我們改成間隔1度的話
就好了



設凸輪之半徑為15公分,以順時針方向旋轉,其從動件為梢型,垂直接觸,長為10公分,從動件之運動
係依照第二項之運動型式。試繪出此凸輪之工作曲線。


function [x,y]=pincam(cth,r0,s,e,L,range,pattern,cw)
%Find the pin type cam with an offsect e
%Inputs:
% cth:angle of cam, degrees
% r0:radius of base circle
% e:offset
% s:stroke
% L:length of pin
% cw:rotation direction of cam(-counterclockwise,+clockwise
%pattern = denote the type of motion used(a 3 element-row matrix)
% 1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
% 5:polynomial motion
% example [4 3]
%range =the degrees the specific motion starts, eg.[90 180 240]
% Example: [x y]=pincam([10 60],5,2,1,10,[90 180 240],[4 3],-1)
figure(1);
clf;
th=cth*pi/180;
s0=sqrt(r0*r0-e*e);
for i=1:length(cth)
t=th(i)*cw;
A=[cos(t) -sin(t);sin(t) cos(t)];
[ym,yy,yyy]=dwell(cth(i),range,pattern);
x0=s0+ym*s;
Sx=[0 x0 x0+L;e e e];
X=A\Sx;
x(i)=X(1,2);y(i)=X(2,2);
line(X(1,1:2),X(2,1:2));
line(X(1,2:3),X(2,2:3),'linewidth',3,'color','red')
end
hold on;
plot([0 x],[0 y],'ro',x,y,'k-')
axis equal


pincam([0:10:360],15,5,0,10,[100 200 260],[2 2],-1)

突輪與從動件的關係




你能讓此凸輪迴轉嗎?

此題最有挑戰性的
是要找出凸輪的相對位置
然後加以旋轉

function [x,y]=pincam3(cth,r0,s,e,L,range,pattern,cw)
%Find the pin type cam with an offsect e
%Inputs:
% cth:angle of cam, degrees
% r0:radius of base circle
% e:offset
% s:stroke
% L:length of pin
% cw:rotation direction of cam(-counterclockwise,+clockwise
%pattern = denote the type of motion used(a 3 element-row matrix)
% 1:uniform 2:parabolic 3:simple harmonic 4: cycloidal
% 5:polynomial motion
% example [4 3]
%range =the degrees the specific motion starts, eg.[90 180 240]
% Example: [x y]=pincam([10 60],5,2,1,10,[90 180 240],[4 3],-1)
figure(4);
clf;
th=cth*pi/180;
s0=sqrt(r0*r0-e*e);
for i=1:length(cth)
t=th(i)*cw;
A=[cos(t) -sin(t);sin(t) cos(t)];
[ym,yy,yyy]=dwell(cth(i),range,pattern);
x0=s0+ym*s;
Sx=[0 x0 x0+L;e e e];
X=A\Sx;
x(i)=X(1,2);y(i)=X(2,2);
%line(X(1,1:2),X(2,1:2));

%line(X(1,2:3),X(2,2:3),'linewidth',3,'color','red')
%pause(0.5)
%clf

end

for i=1:length(cth)
clf ;
t=th(i)*cw;
B=[cosd(90) -sind(90);sind(90) cosd(90)];
A=[cos(t) -sin(t);sin(t) cos(t)];
[ym,yy,yyy]=dwell(cth(i),range,pattern);
o=x*cos(-t)+y*sin(-t)
p=x*sin(-t)-y*cos(-t)
m=o*cosd(90)+p*sind(90)
n=o*sind(90)-p*cosd(90)
plot([0 m],[0 n],'ro',m,n,'k-')
axis([-50 50 -50 50])
grid on;
x0=s0+ym*s;
Sx=[0 x0 x0+L;e e e];
X=B*Sx;
%line(X(1,1:2),X(2,1:2));
line(X(1,2:3),X(2,2:3),'linewidth',3,'color','red')
pause(0.5)
end
hold on;

grid on


動畫~~~ 成功!

2007年5月26日 星期六

機動學第十次作業

本人有上本週的課


請思考速度與加速度的問題,當一桿以某特定點M等角速度迴轉時,其端點P之速度方向如何?
其加速度方向如何?

在動力學的分析中
P的速度為 w x r
而其方向為切線方向




但是因為這是一個 rotaional motion
所以P點一定有加速度
而加速度為 w x w x r





若該特定點M復以等速水平運動,則同一端點P之速度與加速度方向會變為如何?
若M點同時也有加速度,則點P會有何變化?

如果M點只是水平運動時
那在動力學裡也有學到
此時的P點速度為 (Vm + w x r)
而加速度仍是為w x w x r

如果M點也有加速度時
那P點的加速度為 Ap + w x w x r


若以此推理四連桿的運動,則點P與Q之速度與加速度方向會與桿一(固定桿)之兩端點之關係如何?
與我們前面的作業分析結果有無共通之處?(參看第六章之四連桿機構之運動分析)



固定桿兩端為O點和R點,此兩點由於接地,其速度與加速度皆為0,
此時我們若以第二桿為驅動桿,
則P點速度為
VP=Wop x Rp/o  方向與桿二垂直

AP=[αx Rp/o]+[Wop x (Wop x Rp/o)] 前項為切線加速度與桿2垂直,後項為法線加速度指向O點



Q點的速度與加速度
由於P點有速度
所以Q點的速度為
Vq = Vp + Wpq x Rq/p
但是由於Vq 是硍R點連接 而R點為接地點
所Q點的速度也為 Wq r x Rq/r  方向與桿四垂直

同樣加速度也是
Aq = Ap+α x Rq/p + Wpq x (Wpq x Rq/p)
也等於 α x Rq/r + Wqr x (Wqr x Rq/r) 
切線加速度與桿四垂直,法線加速度指向R點


設有一運動之曲柄滑塊連桿組合,設滑塊之偏置量為零,且在水平方向移動,
試以此機構之曲桿長度及角度,以及連結桿之長度為輸入項,利用matlab寫出一程式計算在不同曲柄角度時,
六點瞬心之對應位置。可順便探討六點瞬心與曲柄角間之關係。

在四連桿的時候
會有六個IC
但是有兩點固定
所以有兩點會在無限遠

現在用老師的程式改一下
用裡面的數據 把IC的置找出來


function [values]=drawsldlinksic(R1,R2,th2,sigma,driver)
clf;
r=[10,R1,R2,0]
th1=0;
AXIS([-5 5 -5 5]);
[values b]=sldlink(r,th1,th2,10,0,sigma,driver);
rr=values(:,1);rr(3)=rr(3)+rr(2);
rx=real(rr);
rx(4)=0;
ry=imag(rr);
ry(4)=0;
t=linspace(pi/2,2.5*pi,361);
C1=0.2*exp(j*t');
x1=real(C1);
y1=imag(C1);
line(x1,y1,'LineWidth',1.5);
C2=0.4*exp(j*t');
x2=real(C2);
y2=imag(C2);
line(x2,y2,'LineWidth',2);
line([x2(91) x2(91)],[y2(91) y2(91)-0.5],'LineWidth',1.5);
line([x2(271) x2(271)],[y2(271) y2(271)-0.5],'LineWidth',1.5);
line([x2(91)-1.5 x2(271)+1.5],[y2(271)-0.5 y2(271)-0.5],'LineWidth',1.5,'linestyle',':');
hold on;
if rx(1)>0,
the2=th2;
else
the2=180-th2;
end;
the3=-values(3,2)
ic13x=rx(1);
ic13y=rx(1)*tand(the2);
ic24x=0;
ic24y=rx(1)*tand(the3);
if b==1
plot([0 rx(1)],[0 0],'k-','LineWidth',5);
hold on;
plot([0 rx(1)],[0 ry(1)],'g-','LineWidth',1.5);
plot([rx(1) ic13x],[ry(1) ic13y],'k:','LineWidth',1.5);
plot([rx(2) ic13x],[ry(2) ic13y],'k:','LineWidth',1.5);
plot([0 ic24x],[0 ic24y],'k:','LineWidth',1.5);
plot([rx(2) ic24x],[ry(2) ic24y],'k:','LineWidth',1.5);

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)],'k-');
plot(rx,ry,'bo');
plot(ic13x,ic13y,'mo');
plot(ic24x,ic24y,'mo');
text(0,0,' O 12');text(rx(1),ry(1),' R');
text(rx(2),ry(2),' P 23');
text(rx(3),ry(3),' Q 34');
text(ic13x,ic13y,'13');
text(ic24x,ic24y,'24');
length=max(abs(values(2:3,1)));
len=.20*length;ww=.15*length;

[coords] = sldbox(len,ww,rx(3),ry(3),th1);
plot(coords(:,1),coords(:,2),'r-','LineWidth',2);
[coords] = sldbox(len*3,0,rx(3),ry(3)-ww/2,th1);
plot(coords(:,1),coords(:,2),'r:','LineWidth',1.5);
else
fprintf('Combination of links fails at degrees %6.1f\n',th2);
end

axis equal;
grid on;


下面是動畫



我們可以觀一下IC的移動
何時會在上面 何時會在下面
有時會在無限遠哦~~

2007年5月17日 星期四

機動學第九次作業

B94611048 張志鵬

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


r(1) 固定桿
r(2) 曲桿 =58
r(3) 結合(連)桿=63
r(4) 垂直偏置量=10
theta1 第一桿之水平角
theta2 驅動桿之水平夾角
td2 驅動桿角速度
tdd2 驅動桿角加速度
sigma 組合模數
driver 驅動桿


限制角度
老師在網路上有寫出sld_angle_limits
可以做限制角度的分析

function [Qstart, Qstop]=sld_angle_limits(r,theta1,linkdrive)
%
%function [Qstart, Qstop]=sld_angle_limits(r,theta1,linkdrive)%
Find initital & final angles of driving link for slider
% linkdrive= 0 for crank; 1 for coupler as the driver, with
% Qstart & Qstop as the limit angles of driving link.
% linkdrive=2 for slider as input, with Qstart & Qstop as its
% initial & final positions of r1% Variables
% r= linkage row vector (cm)
% Examples:[Qst,Qsp]=sld_angle_limits([1 5 3 1],30,0)
r1=r(1);r2=r(2);r3=r(3);r4=r(4);g2d=180/pi;
switch linkdrive
case 0 %crank
if r3+r4<r2 & r4>=0 & r3>r4
Qstart=asin((r4-r3)/r2);Qstop=asin((r4+r3)/r2);
elseif r3+r4>=r2 & r4>=r3 & r3>=0
Qstart=asin((r4-r3)/r2);Qstop=pi-asin((r4-r3)/r2);
elseif r3-r4<=r2 & r4<0 & r3>=-r4
Qstart=asin((r4-r3)/r2);Qstop=asin((r4+r3)/r2);
elseif r3-r4>=r2 & r3>=0 & -r4>=r3
Qstart=-pi-asin((r4+r3)/r2);Qstop=asin((r4+r3)/r2);
else
Qstart=0;Qstop=2*pi;
end
case 1 %coupler
if r2-r4<=r3 & r4>=0 & r2>=r4
Qstart=asin((r4-r2)/r3);Qstop=pi-asin((r4-r2)/r3);
elseif r2+r4<r3 & r4>=0
Qstart=asin((r4-r2)/r3);Qstop=asin((r4+r2)/r3);
elseif r2+r4<=r3 & r4<=0 & r2+r4>=0
Qstart=-pi-asin((r4+r2)/r3);
Qstop=asin((r4+r2)/r3);
elseif r2-r4<r3 & r4<=0
Qstart=asin((r4-r2)/r3);Qstop=asin((r4+r2)/r3);
else %r2>=(r3+abs(r4))
Qstart=0;Qstop=2*pi;
end
case 2 %slider displacement
Qstart=0;Qstop=0;
arg2=(r2+r3)^2-r4^2;
if abs(r2-r3)>=r4
arg1=(r2-r3)^2-r4^2;
if arg1>0,Qstart=sqrt(arg1);end;
Qstop=sqrt(arg2);
else
if arg2<0, return; end
Qstart=sqrt(arg2);Qstop=-sqrt(arg2);
end
theta1=0;g2d=1;end %case
if Qstop<Qstart,TT=Qstart;Qstart=Qstop;Qstop=TT;end
adjust=(Qstop-Qstart)*1e-8;
Qstart=theta1+(Qstart+adjust)*g2d;
Qstop=theta1+(Qstop-adjust)*g2d;


以第二桿為驅動桿

r=[0 58 63 10];
theta1=0;
linkdrive=0;
sld_angle_limits(r,theta1,linkdrive);


結果如下

Qstart =

-66.0349

Qstop =

246.0349


限制角度位置圖

以第二桿為驅動桿


以第三桿為驅動桿


所以只有在這範圍裡面的值才有效

在了解角度限制後 就可以做動畫了

function [values]=drawsldlinks(r,th1,th2,sigma,driver)
%function drawlinks(r,th1,th2,sigma,driver)
%draw the positions of four-bar links
%call f4bar funcion
%r: row vector for four links
%th1: frame angle
%th2: crank angle or couple angle
%sigma: assembly mode
%driver: 0 for crank, 1 for coupler
%% Example:
% drawsldlinks([1 2 3 4],0,60,1,0)
%clf;
[values b]=sldlink(r,th1,th2,10,0,sigma,driver)
;rr=values(:,1);rr(3)=rr(3)+rr(2);
rx=real(rr);rx(4)=0;
ry=imag(rr);ry(4)=0;
if b==1
plot([0 rx(1)],[0 0],'k-','LineWidth',4);%ground line
hold on;
plot([0 rx(1)],[0 ry(1)],'g-','LineWidth',1.5);
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)],'k-');
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');
length=max(abs(values(2:3,1)));
len=.20*length;ww=.15*length;
[coords] = sldbox(len,ww,rx(3),ry(3),th1);
plot(coords(:,1),coords(:,2),'r-','LineWidth',2);
[coords] = sldbox(len*3,0,rx(3),ry(3)-ww/2,th1);
plot(coords(:,1),coords(:,2),'r:','LineWidth',1.5);else
fprintf('Combination of links fails at degrees %6.1f\n',th2);
axis equal;
grid on;
end
axis equal;
grid on;



以第二桿為驅動桿
運動動畫


for i=-66.0349:1:246.0349;
drawsldlinks([0 58 63 10],0,i,1,0)
axis([-80 80 -80 125]);
end;




位置分析
利用以上的程式 可以得到各點的位置、速度和加速度

一桿位置 0.0775 一桿角度 0 一桿角速度 0 一桿角加速度 0
二桿位置 0.0290 + 0.0502i 二桿角度 0.0600 二桿角速度 0.0100 二桿角加速度 0
三桿位置 0.0485 - 0.0402i 三桿角度 -0.0397 三桿角速度 -0.0060 三桿角加速度 0.0739
四桿位置 0.0000 + 0.0100i 四桿角度 0.0900 四桿角速度 0 四桿角加速度 0

Q位置向量 0.0290 + 0.0502i q速度 -2.9000 - 5.0229i q加速度-0.1200
P位置向量 0.0775 + 0.0100i p速度 -1.6611 p加速度 0.1800

0.0775 0 0 0 -0.7429
0.0290 + 0.0502i 0.0600 0.0100 0 -1.6611
0.0485 - 0.0402i -0.0397 -0.0060 0.0739 0.0290 + 0.0502i
0.0000 + 0.0100i 0.0900 0 0 0.0775 + 0.0100i


-0.5023 + 0.2900i 0.5800 0.1500
-0.7429 0.7429 0.1800
-2.9000 - 5.0229i 5.8000 -0.1200
-1.6611 1.6611 0.1800

其他的驅動桿的做法也大同小異



路徑分析
在老師的講議中
有一個程式叫drawsldpaths
我看了很久也看不太懂 只能說老師太利害了!!
相當的精彩 值得去了解



function drawsldpaths(r6,th6,r,th1,td2,tdd2,sigma,npts,driver,mode)
clf;
figure(1);
warning off;
r(abs(r)<eps)=eps;
[Qstart, Qstop]=sld_angle_limits(r,th1,driver)
npoint=abs(npts);
th2=linspace(Qstart,Qstop,npoint);
val=zeros(11,npoint);
for i=1:npoint,
if driver==2, r(1)=th2(i);end
[vr b]=sldlink(r,th1,th2(i),td2,tdd2,sigma,driver);
[para]=body(r6,th6,vr,3);
if mod(i,5)==0|i==1|i==npoint,
drawsldlinks(r,th1,th2(i),sigma,driver);

end
val(1:3,i)=[vr(1,1)+vr(4,1);vr(2,1);para(2)];
switch driver
case 0
val(4:7,i)=[abs(vr(1,1));vr(3,2);vr(3,3);vr(3,4)];
case 1
val(4:7,i)=[abs(vr(1,1));vr(2,2);vr(2,3);vr(2,4)];
case 2
val(4:7,i)=[abs(vr(2,2));vr(3,2);vr(2,3);vr(3,3)];
end
val(8:11,i)=[vr(1,5);para(4);vr(4,6);para(5);];
end
warning on;
plot(val(1,:),'k-','LineWidth',1.5,'linestyle',':');% path of Q
plot(val(2,:),'k-','LineWidth',1.5);% path of P
plot(val(3,:),'g-','LineWidth',1.5);% path of A
axis equal
if mode==0, return;end;
th2=th2(3:end-3);val=val(:,3:end-3);
title0={'Crank Angle','Coupler Angle','Slider Pos'};
title1={'\Theta3(r) & r1(k)', '\Theta2(r) & r1(k)',...
'\Theta2(r) & \Theta3(k)' };
title2={'Vel of A (r) & Slider(k)',...
'Acc of A(r) & Slider(k)' };
title3={'\omega(r) & \alpha(b) of Coupler',...
'\omega(r) & \alpha(b) of Crank',...
'\omega of Crank(r) & Coupler(b)'};
intitle=title0(driver+1);
val(abs(val)>10e+5)=NaN;
val(8:11,:)=abs(val(8:11,:));
figure(2);
clf;
subplot(2,2,1);
plot(th2,val(4,:),'k-');
hold on;fact=round(max(val(5,:))/max(val(4,:))*10)/10;
plot(th2,val(5,:)/fact,'r-');% crank or coupler angle
xlabel(intitle);ylabel(title1(driver+1));
grid on
subplot(2,2,2);
plot(th2,val(6,:),'r-');
fact=round(max(val(7,:))/max(val(6,:))*10)/10;
hold on;plot(th2,val(7,:)/fact,'b-');
xlabel(intitle);ylabel(title3(driver+1));
grid on;
subplot(2,2,3);
plot(th2,val(8,:),'k-');
hold on;plot(th2,val(9,:),'r-');
xlabel(intitle);ylabel(title2(1));
grid on;
subplot(2,2,4);
plot(th2,val(10,:),'k-');
hold on;plot(th2,val(11,:),'r-');
xlabel(intitle);ylabel(title2(2));
grid on;


drawsldpaths(0,0,[0 58 63 10],0,10,10,1,50,0,1)



2007年5月8日 星期二

第八次作業





B94611048 張志鵬本人4月26日曾來上課


題目
有一組四連桿,其桿長分別為r=[4 3 3 5],由桿2驅動設第一固定桿角度theta1=0度角速度 td2=10rad/s角加速度tdd2=0 rad/s^2

問題一 設桿2角度theta2=45度時,求各點之位置、速度與加速度為何?
下面為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 driving link is
% crank or coupler. 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 mode="1;end" data="zeros(4,6);" linkdrive="=" r="[r(1)" rr="r.*r;d2g=" t1="theta(1);tx=" s1="sin(t1);c1=" sx="sin(tx);cx=" 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;">=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 f
orm=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)
四連桿之角度為:
第一桿 第二桿 第三桿 第四桿
0 45.0000 69.4856 99.5246
各桿之速度則為:
第一桿 第二桿 第三桿 第四桿
0 10.0000 16.2681 4.9677
各桿之加速度為:
第一桿 第二桿 第三桿 第四桿
0 0 491.4428 383.6120
P點的 位置 速度 加速度
2.1213 + 2.1213i 0.0212 + 0.0212i -0.2121 - 0.2121i
Q點的 位置 速度 加速度
3.1726 + 4.9311i 0.0041 - 0.0245i -1.8712 - 0.4391i

問題二 繪出此四連桿之相關位置及標明各點之速度方向及大小
程式drawlinks之目的即是利用MATLAB繪製四連桿之相關位置。
所以程式本身會呼叫f4bar.m函數以計算四連桿之向量位置,然後加以繪圖。

function [values]=drawlinks(r,th1,th2,mode,linkdrive)
%function drawlinks(r,th1,th2,mode,linkdrive)
%draw the positions of four-bar links
%call f4bar funcion
%r: row vector for four links
%th1: frame angle
%th2: crank angle or couple angle
%mode: assembly mode
%linkdrive: 0 for crank, 1 for coupler
%clf;
if nargin<5,linkdrive=0;end mode="1;end" rr="values(:,1);rr(3,1)=" rx="real(rr(:,1));rx(4)=" ry="imag(rr(:,1));ry(4)=" b="=" linkdrive="=" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs_XAqnlzgujB0onb96zWoaaf3oMVZBRNlALHQ5d_x-tziETX1heySgyYNs2obGpwUqOybYeTqcd5J4jZmHYzXoS2BZTtzOj4Vgo7teXZmLcSJNEM-_9ahABQpdVEyLgkTU-FWQawPIpPu/s1600-h/b94611048-matlabpic-HW8-1-2.jpg">
第三題 當桿2迴轉時,求出此組四連桿之限制角度,並繪出其位置
function [Ang1, Ang2]=fb_angle_limits(r,theta1,linkdrive)
%%function [Ang1, Ang2]=fb_angle_limits(r,theta1,linkdrive)
% Find initital & final angles for the driving link
% linkdrive= (0 for crank; 1 for coupler as the driver).
% Variables:
% r=linkage row vector (cm)
% theta1=frame angle(degree);
% Ang1,Ang2=initial & final angles of the driving link(deg)
%Program
if nargin<3,linkdrive=0;end theta1="0;end" linkdrive="=" r="[r(1)" r1="r(1);r2=" r3="r(3);r4=" rmin="min(r);rmax=" rtotal="sum(r);Ang1=" ang2="2*pi;">(r3+r4)& abs(r1-r2)(r3+r4)& abs(r1-r2)>=abs(r3-r4)
Ang1=acos((r2^2-(r4+r3)^2+r1^2)/(2*r1*r2));
Ang2=-Ang1;
end
% if (r1+r2)<=(r3+r4)&abs(r1-r2)>=abs(r3-r4)
% Ang1=0;
% Ang2=2*pi;
% end
if (r1+r2)<=(r3+r4)&abs(r1-r2)< ang1="acos((r2^2-(r4-r3)^2+r1^2)/(2*r1*r2));" ang2="2*pi-Ang1;" adjst =" (Ang2-Ang1)*1e-8;" ang1="theta1+(Ang1+adjst)*180/pi;" ang2="theta1+(Ang2-adjst)*180/pi;" tt="Ang1;Ang1=" ang2="TT;end" qstart =" 28.9550" qstop =" 331.0450" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKjNMCI-_92A8-6ernZ2tyBvuqmCOXld5LerL2BNJOzwIH8RfxmxOaFppb9oPdO4BXs7md4y6G_-uYLw7GnzfJcKVm3jZmKy6HCMXrbN6_mDLq3S96o1N3MfQ_NJkDJuz2sd3JRvwGIpwI/s1600-h/b94611048-matlabpic-HW8-1-3.jpg">




第四題
設theta2=[0:20:360],試繪出此組四連桿之重疊影像,解釋為何有些沒有值
clf;
for i=0:20:360,
drawlinks([4 3 3 5],0,i,-1,0); 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

在第三題時 我們求出四連桿之限制角度
從28.955到331.045間才可做旋轉其他角度是不可能發生的



第五題 若將問題三考慮在內,只在可迴轉的範圍內迴轉,請問你能讓此組四連桿作成動畫方式迴轉嗎
下面這程式真的很精彩!!! 可以繪出所有的軌蹪

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=" npoint="abs(npts);" th2="linspace(Qstart,Qstop,npoint);" val="zeros(6,npoint);" i="1:npoint," x="real(val);y=" h="f4limits(r,th1,sigma,driver);" range="1.2*([min(min(x))" i="2:4,set(h(i),'erasemode','xor');end" h0="patch('xdata',[],'ydata',[],'erasemode','xor','facecolor','r',..." i="0;s=" m="1:ntimes" s="-s;" i="0;s=" i="i+s;">npointi==0,break;end;
set(h(2),'xdata',[0 x(2,i)], 'ydata',[ (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


move_4paths([4 3 3 5],0,0,3,0,10,0,1,0,4,150)



下面是我的影片

2007年4月23日 星期一

第七次作業

本人4/19有上課

這次作業有用到 function dyad_draw() 而其中有用到function dyad()

function [vec, dyadata] = dyad(rho,theta,td,tdd)
%
% function [vec, th, dyadata] = dyad(rho,theta,td,tdd)
% Analyzes a dyad linkage composing a crank and a dyad.
% Inputs: rho:length of links
% theta:incling angles, deg.
% td:angular velocity, rad/s
% tdd:angular acceleration, rad/s^2
% Outputs: vec:absoute length of links
% th:angles of links, velocities & acc, deg
% dyadata:original data, in complex forms
% Example:[vec,th,dyadata] = dyad([5 10],[30 50],[2 4])
theta=theta(:); rho=rho(:);
n=length(rho);
if nargin<4, tdd="zeros(size(rho));" nargin="=" td="ones(size(rho));" td="ones(size(rho))*td;" tdd="ones(size(rho))*tdd;" td="td(:);" tdd="tdd(:);" d2g="pi/180;" tt="exp(i*theta*d2g);" pp="rho.*tt;" vv="i*td.*pp;" aa="-pp.*td.^2+i*pp.*tdd;" dyadata="[pp" vec="[abs(sum(dyadata));angle(sum(dyadata))/d2g];" x="[0;cumsum(real(data(:,1)))];" y="[0;cumsum(imag(data(:,1)))];" i="1:length(x)-1" k="1:length(rho)" x0="x(k+1);" y0="y(k+1);" vx="x0+real(data(k,2));" vy="y0+imag(data(k,2));" ax="x0+real(data(k,3));" ay="y0+imag(data(k,3));" sdata="sum(data);" ss="[real(sdata(1))" vv="[real(sdata(2))" aa="[real(sdata(3))" nargin="=" dd="1;" 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;">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

p.7-1-1 

在0-5秒內 端桿之對應方位

第零秒

第一秒
第二秒
第三秒
第四秒


第五秒

p.7-1-2
第一桿之速度

第一桿之加速度
第二桿之速度


第二桿之加速度


第三桿之速度


第三桿之加速度



p.7-1-3
將過程繪製成影片
axis equal;
AXIS([-180 180 -180 160]);
dyad_draw([58,63,53],[0,0,0],[0.2,0.5,0.3],[0,0.1,0.2]);pause(5)
clf
for n=1:5
axis equal;
AXIS([-180 180 -180 160]);
dyad_draw([58,63,53],[0.2,0.5+n*0.1,0.3+n*0.2],[0.2,0.5+n*0.1,0.3+n*0.2],[0,0.1,0.2]);
pause(1)
clf
end;




第六次作業

b94611048 張志鵬
本次作業有用到課本裡的function gruebler 及 function grashof
function [df]=gruebler(nlink,jointype)
%% [df]=gruebler(nlink,jointype)
% nlink:no. of total links
% jointype:row matrix for number of joints for each type,
% the order of elements is:
% 1 R-joint 2 slider 3 compound joint(sliding & rolling)
% 4 ball 5 cylinder 6 planar 7 cylinder rolling
% 8 cam 9 helix 10 ball & 11 point contact
% Example: df=gruebler(4,[4])
% Author:D.S.Fon Bime,NTU. Date:Jan. 30, 2007
code=[1 1 2 3 2 3 1 2 1 3 5];
n=length(jointype);
dim=3;
if n>3, dim=6;
end;
ff=0;
njoint=0;
for i=1:n, njoint=njoint+jointype(i);
ff=ff+jointype(i)*code(i);
end;
df=dim*(nlink-njoint-1)+ff;

function ans=grashof(ground_no,linkage)
% Function to test the Grashof linkage
% Inputs:
% ground_no:the ground link number in the order
% linkage: row matrix for lengths of the 4 links
% in original assigned order.
% Example:ans=grashof(4,[4 4.2 2.6 2])
% Revised: March 4, 2006
ground=linkage(ground_no);
link=sort(linkage);% sorting the links
ig=find(linkage==link(1));
if link(1)+link(4)>link(3)+link(2),
ans='Non-Grashof Linkage';
elseif
link(1)+link(4)==link(3)+link(2)
ans='Neutral Linkage';
elseif link(1)==ground,
ans='Double-Crank 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='Crank-Rocker Linkage';
end
end

p.6-1-1 

機構共有十二隻桿及十五個結






p.6-1-2 
M=3*(N-J-1)+F N=12 J=15  
十二個旋轉結
一個滑動結
兩個滑槽結 
所以 F=12*1+1*1+2*2=17 M=-12+17=5 
自由度為5

p.6-1-3 

函式輸入 
gruebler(12,[12 1 2]) 
自由度為5

p.6-1-4
滑塊因與地面間的滑動特性,使系統多了一個滑動結滑槽是因其可提供滑動與轉動的自由,自由度+2

p.6-2-1 
J2,J3,J5 為球結, 自由度為3 
J1,J6 為旋轉結,自由度為1 
J5 為圓柱結,自由度為2





p.6-2-2
F=3*3+2*1+1*2 
M=6(N-J-1)+F=6(6-6-1)+13 
M=7 自由度為7

p.6-2-3 
函式輸入 
gruebler(6,[2 0 0 3 1]) 
自由度為7

p.6-2-4 
此機構是有惰性自由度,5號桿與6號桿是可以自轉的,所以機構的惰性自由度為2,
總自由度為7-2=5 
惰性自由度使系統的總自由度減少,
因為可自轉軸的自轉角度並不會影響系統之外型

p.6-3-1
葛拉索型: 
在四連桿組中,最短桿與最長桿之和小於其他兩桿之和時,則至少有一桿為可旋轉桿。
非葛拉索型: 
最短桿與最長桿之和大於其他兩桿之和時,所有的活動連桿必為搖桿

p.6-3-2 
第一組,7+4=6+5
中立連桿組
grashof(1,[7 4 6 5]) ans = Neutral Linkage

第二組中,8+3.6>5.1+4.1
非葛拉索連桿 
grashof(1,[8 3.6 5.1 4.1])
ans = Non-Grashof Linkage

第三組中,
6.6+3.1<5.4+4.7
葛拉索型 
grashof(1,[5.4 3.1 6.6 4.7])
ans = Crank-Rocker Linkage

p.6-3-3
第二組四連桿為非葛拉索型,
要將他改成葛拉索型機構的話,
可將最長桿火最短桿減短,
或是將第二和第三連桿長度增加,
達到葛拉索機構的要求。 

2007年4月11日 星期三

機動學第五次作業

p.5.1.1
%L1是上手臂的長度
%L1是下手臂的長度
%L1是手腕的長度
L1=35;
L2=30;
L3=10;
r1=L1/6;
r2=L1/12;
r3=L3/2;
r4=L2/11;
%以下是我設計的外型
arm1x=[0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 r2*cosd(60)+11*r2 r2*cosd(30)+11*r2 r2*cosd(0)+11*r2 r2*cosd(-30)+11*r2 r2*cosd(-60)+11*r2 11*r2 r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 L1];

arm1y=[0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) r2*sind(0) r2*sind(-30)r2*sind(-60) -r2 -r1 r1*sind(240) r1*sind(210) 0 0];

arm2x=[L1 r4*cosd(30)+L1-L2+10*L2/11 r4*cosd(60)+L1-L2+10*L2/11 L1-L2+10*L2/11 L1-L2+L2/11 r4*cosd(120)+L1-L2+L2/11 r4*cosd(150)+L1-L2+L2/11 r4*cosd(180)+L1-L2+L2/11 r4*cosd(210)+L1-L2+L2/11 r4*cosd(240)+L1-L2+L2/11 L1-L2+L2/11 L1-L2+10*L2/11 r4*cosd(-60)+L1-L2+10*L2/11 r4*cosd(-30)+L1-L2+10*L2/11 r4*cosd(0)+L1-L2+10*L2/11 L1-L2];

arm2y=[0 r4*sind(30) r4*sind(60) r4 r4 r4*sind(120) r4*sind(150) r4*sind(180) r4*sind(210) r4*sind(240) -r4 -r4 r4*sind(-60) r4*sind(-30) r4*sind(0) 0];

palmx=[L1-L2 L1-L2 L1-L2+L3 L1-L2 L1-L2 L1-L2+L3];

palmy=[0 r4 0 -r4 0 0];

axis equal
line(arm1x,arm1y);
line(arm2x,arm2y);
line(palmx,palmy);

以是是我在零度時的圖


p.5-1-2

%function body 的設計

function body(L1,L2,L3,theta1,theta2,theta3)
r1=L1/6;
r2=L1/12;
r3=L3/2;
r4=L2/11;


arm1x=[0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 r2*cosd(60)+11*r2 r2*cosd(30)+11*r2 r2*cosd(0)+11*r2 r2*cosd(-30)+11*r2 r2*cosd(-60)+11*r2 11*r2 r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 L1];

arm1y=[0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) r2*sind(0) r2*sind(-30) r2*sind(-60) -r2 -r1 r1*sind(240) r1*sind(210) 0 0];

arm2x=[L1 r4*cosd(30)+L1-L2+10*L2/11 r4*cosd(60)+L1-L2+10*L2/11 L1-L2+10*L2/11 L1-L2+L2/11 r4*cosd(120)+L1-L2+L2/11 r4*cosd(150)+L1-L2+L2/11 r4*cosd(180)+L1-L2+L2/11 r4*cosd(210)+L1-L2+L2/11 r4*cosd(240)+L1-L2+L2/11 L1-L2+L2/11 L1-L2+10*L2/11 r4*cosd(-60)+L1-L2+10*L2/11 r4*cosd(-30)+L1-L2+10*L2/11 r4*cosd(0)+L1-L2+10*L2/11 L1-L2];

arm2y=[0 r4*sind(30) r4*sind(60) r4 r4 r4*sind(120) r4*sind(150) r4*sind(180) r4*sind(210) r4*sind(240) -r4 -r4 r4*sind(-60) r4*sind(-30) r4*sind(0) 0];

palmx=[L1-L2 L1-L2 L1-L2+L3 L1-L2 L1-L2 L1-L2+L3];

palmy=[0 r4 0 -r4 0 0];

axis equal
line(arm1x,arm1y);
line(arm2x,arm2y);
line(palmx,palmy);
clf


%這個for loop 在這裡沒用 在第四小題才有用
for n=1:1;
axis equal
AXIS([-80 80 -70 70]);
x1=arm1x*cosd(-theta1(n))-arm1y*sind(-theta1(n));
y1=arm1x*sind(-theta1(n))+arm1y*cosd(-theta1(n));
line(x1,y1)
theta2(n)=180+theta1(n)-theta2(n);
x2=arm2x*cosd(-theta2(n))-arm2y*sind(-theta2(n))+x1(16)-(L1-L2)*cosd(-theta2(n));
y2=arm2x*sind(-theta2(n))+arm2y*cosd(-theta2(n))+y1(16)-(L1-L2)*sind(-theta2(n));
line(x2,y2)
theta3(n)=180+theta2(n)-theta3(n);
x3=palmx*cosd(-theta3(n))-palmy*sind(-theta3(n))+x2(15)-(L1-L2)*cosd(-theta3(n));
y3=palmx*sind(-theta3(n))+palmy*cosd(-theta3(n))+y2(15)-(L1-L2)*sind(-theta3(n));
line(x3,y3)
end;

p.5-1-3

將數值輸入body(35,30,10,90,-45,-30)

下面是我theta1=90 theta2=-45 theta3=-30 時的圖





p.5-1-4

L1=35;
L2=30;
L3=10;
r1=L1/6;
r2=L1/12;
r3=L3/2;
r4=L2/11;

arm1x=[0 r1*cosd(150)+r1 r1*cosd(120)+r1 r1 11*r2 r2*cosd(60)+11*r2 r2*cosd(30)+11*r2 r2*cosd(0)+11*r2 r2*cosd(-30)+11*r2 r2*cosd(-60)+11*r2 11*r2 r1 r1*cosd(240)+r1 r1*cosd(210)+r1 0 L1];
arm1y=[0 r1*sind(150) r1*sind(120) r1 r2 r2*sind(60) r2*sind(30) r2*sind(0) r2*sind(-30) r2*sind(-60) -r2 -r1 r1*sind(240) r1*sind(210) 0 0];
arm2x=[L1 r4*cosd(30)+L1-L2+10*L2/11 r4*cosd(60)+L1-L2+10*L2/11 L1-L2+10*L2/11 L1-L2+L2/11 r4*cosd(120)+L1-L2+L2/11 r4*cosd(150)+L1-L2+L2/11 r4*cosd(180)+L1-L2+L2/11 r4*cosd(210)+L1-L2+L2/11 r4*cosd(240)+L1-L2+L2/11 L1-L2+L2/11 L1-L2+10*L2/11 r4*cosd(-60)+L1-L2+10*L2/11 r4*cosd(-30)+L1-L2+10*L2/11 r4*cosd(0)+L1-L2+10*L2/11 L1-L2];
arm2y=[0 r4*sind(30) r4*sind(60) r4 r4 r4*sind(120) r4*sind(150) r4*sind(180) r4*sind(210) r4*sind(240) -r4 -r4 r4*sind(-60) r4*sind(-30) r4*sind(0) 0];
palmx=[L1-L2 L1-L2 L1-L2+L3 L1-L2 L1-L2 L1-L2+L3];
palmy=[0 r4 0 -r4 0 0];
axis equal
line(arm1x,arm1y);
line(arm2x,arm2y);
line(palmx,palmy);
clf

%將每個角度分成十份
theta1=linspace(-90,-75,10)
theta2=linspace(-45,-35,10)
theta3=linspace(-30,-10,10)
for n=1:10;
axis equal
AXIS([-70 70 -70 40]);
x1=arm1x*cosd(-theta1(n))-arm1y*sind(-theta1(n));
y1=arm1x*sind(-theta1(n))+arm1y*cosd(-theta1(n));
line(x1,y1)
theta2(n)=180+theta1(n)-theta2(n);
x2=arm2x*cosd(-theta2(n))-arm2y*sind(-theta2(n))+x1(16)-(L1-L2)*cosd(-theta2(n));
y2=arm2x*sind(-theta2(n))+arm2y*cosd(-theta2(n))+y1(16)-(L1-L2)*sind(-theta2(n));
line(x2,y2)
theta3(n)=180+theta2(n)-theta3(n);
x3=palmx*cosd(-theta3(n))-palmy*sind(-theta3(n))+x2(15)-(L1-L2)*cosd(-theta3(n));
y3=palmx*sind(-theta3(n))+palmy*cosd(-theta3(n))+y2(15)-(L1-L2)*sind(-theta3(n));
line(x3,y3)
pause(0.5)
clf
end;
這網站是我做出來的動畫
http://www.youtube.com/watch?v=ZEM30bnEnPY

p.5.2.1
手指可分為三節每一節只能旋轉90度若手腕為一桿,一端為定點,加上手指的連結點,就是有三個接點在平的角度來看,自由度總和為1+1+1=3;
p.5.2.2
%下面是手指的function 內部有用到linkshape
function finger1(P,theta1,theta2,theta3)
L3=P*(2.5/17);
L2=P*(2/17);
L1=P*(2.5/17);
f1x=[0 L1]
f1y=[0 0]
f2x=[L1 L1-L2]
f2y=[0 0]
f3x=[L1-L2 L1-L2+L3]
f3y=[0 0]
axis equal
AXIS([-10 10 -10 10])
linkshape([f1x(1) f1y(1)],[f1x(2) f1y(2)], 1)
linkshape([f2x(1) f2y(1)],[f2x(2) f2y(2)], 1)l
inkshape([f3x(1) f3y(1)],[f3x(2) f3y(2)], 1)
clfaxis equalAXIS([-8 8 -8 8])
x1=f1x*cosd(-theta1)-f1y*sind(-theta1);
y1=f1x*sind(-theta1)+f1y*cosd(-theta1);
linkshape([x1(1) y1(1)],[x1(2) y1(2)], 1)
theta2=180+theta1-theta2;
x2=f2x*cosd(-theta2)-f2y*sind(-theta2)+x1(2)-(L1-L2)*cosd(-theta2);
y2=f2x*sind(-theta2)+f2y*cosd(-theta2)+y1(2)-(L1-L2)*sind(-theta2);
linkshape([x2(1) y2(1)],[x2(2) y2(2)], 1)
theta3=180+theta2-theta3;
x3=f3x*cosd(-theta3)-f3y*sind(-theta3)+x2(1)-(L1-L2)*cosd(-theta3);
y3=f3x*sind(-theta3)+f3y*cosd(-theta3)+y2(1)-(L1-L2)*sind(-theta3);
linkshape([x3(1) y3(1)],[x3(2) y3(2)], 1)
每一根手指的極限位置
theta1=linspace(0,90,10)
theta2=linspace(150,90,10)
theta3=linspace(150,90,10)
for n=1:10
finger1(17,theta1(n),theta2(n),theta3(n))
pause(0.05)end;for n=1:10 f
inger2(17,theta1(n),theta2(n),theta3(n))
pause(0.05)
end;
for n=1:10
finger3(17,theta1(n),theta2(n),theta3(n))
pause(0.05)end;
for n=1:10
finger4(17,theta1(n),theta2(n),theta3(n))
pause(0.05)
end;





p.5-2-3
假設球的速度為A那在球離開手的那一刻
手的速度也該為A
w=vr r為手半徑 w為angular velocity
a=br a為手當時的加速度 b是angular accelerationand
v=at t是從手開始動到球離開的時間
所以 w,b 都可以求出來



2007年3月24日 星期六

機動學第三次作業

p.3.1第一小題︰
Y1=20:5:55
angle=(Y1.^2+25^2.-30^2.)./(2*30.*Y1)
degree=acos(angle)
X2=25*sin(degree)
Y2=25*cos(degree)
plot(X2+10,Y2,'V')
hold on
plot(0,Y1,'V')
grid on
title('拳頭(左)與關接(右)的位置')

這是我作出來的圖︰







第二小題︰
求出拳頭的移動範圍︰
從頭開始算 = 55-20 = 35cm

第三小題︰
1.假設我們的手臂在運動時只有在一平面有位移
2.假設我的手腕不能轉動



p3.2
(1)旋轉對平面低對的一種,又稱R-型對,應用有門閂,自由度為一

(2)高對與低對運動結低對的兩物件通常處於面,其接觸應力較小
高對僅接觸於一點或一線,其接觸應力較大

(3)型式閉合結或外力閉合結型式閉合為形狀限制
利用外力,使兩桿維持接觸狀態


hold on;
hieght='please enter your height in cm';
a=input(hieght);
a;
for i=1:1:360;
x0=(a/2)*cos(i);
y0=(a/2)*sin(i);
line(x0,y0)
hold on;
end;
for n=1:1:12;
for i=1:1:360
x0=(a/2)*cos(i)+(pi/6)*(a/2)*n;
y0=(a/2)*sin(i);line(x0,y0)
end;
end;
x1=[-2*a/12 2*a/12 2*a/12 -2*a/12 -2*a/12];
y1=[2*a/12 2*a/12 6*a/12 6*a/12 2*a/12];
line(x1,y1)
x2=[0 a*cos(atan(0.5))/2];
y2=[0 a*sin(atan(0.5))/2];
line(x2,y2)
x3=[0 -a*cos(atan(0.5))/2];
y3=[0 a*sin(atan(0.5))/2];
line(x3,y3)x4=[0 0];
y4=[2*a/12 -2*a/12];
line(x4,y4)x5=[0 a/4];
y5=[-2*a/12 -5*a/12];
line(x5,y5)x6=[0 -a/4];
y6=[-2*a/12 -5*a/12];
line(x6,y6)
for n=1:1:12;
x11=x1*cosd(30*n)+y1*sind(30*n);
y11=-x1*sind(30*n)+y1*cosd(30*n);
x12= x11+((pi*n/6)*(a/2));
line(x12,y11,'color','red')
x13=x2*cosd(30*n)+y2*sind(30*n);
y13=-x2*sind(30*n)+y2*cosd(30*n);
x14= x13+((pi*n/6)*(a/2));
line(x14,y13,'color','red')
x15=x3*cosd(30*n)+y3*sind(30*n);
y15=-x3*sind(30*n)+y3*cosd(30*n);
x16= x15+((pi*n/6)*(a/2));
line(x16,y15,'color','red')
x17=x4*cosd(30*n)+y4*sind(30*n);
y17=-x4*sind(30*n)+y4*cosd(30*n);
x18= x17+((pi*n/6)*(a/2));
line(x18,y17,'color','red')
x19=x5*cosd(30*n)+y5*sind(30*n);
y19=-x5*sind(30*n)+y5*cosd(30*n);
x20= x19+((pi*n/6)*(a/2));
line(x20,y19,'color','red')
x21=x6*cosd(30*n)+y6*sind(30*n);
y21=-x6*sind(30*n)+y6*cosd(30*n);
x22= x21+((pi*n/6)*(a/2));
line(x22,y21,'color','red')
axis equal;
end

這是我作出的圖

機動學第四次作業

p.4-1
axis equal;
L=48+10;
AXIS([-90 90 -110 110])
x=[L/2 0 -1*L/2 L/2];
y=[0 (3)^(1/2)*L/2 0 0];
a=line(x,y)
for n=1:90
rotate(a,[0 0 1],4,[L/2 0 0])
pause(0.001)end
for n=1:90
rotate(a,[0 0 1],4,[0 (3)^(1/2)*(L)/2 0])
pause(0.001)
end
for n=1:90
rotate(a,[0 0 1],4,[-1*L/2 0 0])
pause(0.001)
end;


p.4-2

此為function的部分︰
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

主程式部分
linkshape([10 0],[0,0],2)
x=10;
y=0;
x1=[15];
y1=[0];
for n=1:10:360;
x2=x*cosd(n)+y*sind(n);
y2=-x*sind(n)+y*cosd(n);
linkshape([x2,y2], [0,0], 2)
line([x1,x2],[y1,y2]);
end




p.4-3



x1=0;
y1=0;
x2=3;
y2=4;
x3=13;
y3=4;
x4=10;
y4=0;
linkshape([x2 y2],[x1,y1],2);
linkshape([x3 y3],[x2,y2],3);
linkshape([x4 y4],[x3,y3],1.5);
linkshape([x1 y1],[x4,y4],2);
for n=0:1:12;
a=x2*cosd(30*n)+y2*sind(30*n);
b=-x2*sind(30*n)+y2*cosd(30*n);
c=x3+(a-x2);
d=b;
linkshape([a b],[x1,y1],2);
linkshape([c d],[a,b],3);
linkshape([x4 y4],[c,d],1.5);
linkshape([x1 y1],[x4,y4],2);
end;

2007年3月12日 星期一

張志鵬的機動學第二次作業

我們人類經過千千萬萬年的進化,發展出現代人類的構造。科學家們也在這方面研究出許多的結論。以下是我找出的一些資料,有助我們了解人體力學。

http://www.robotics.utexas.edu/rrg/learn_more/low_ed/joints/
這網頁很簡單的介紹了我們日常生活中常會用到的關接,而且也有一些圖供人觀賞,對我們來說,確實是對人類力學的入門好手。


http://www.saburchill.com/chapters/chap0008.html
這網站將人類的關接分為了四大類︰



Ball and Socket Joints























Hinge Joints






















Semi-movable Joints






















Immovable Joints
















而且提供了人類骨骼的真實照片,感覺很實在。


http://www.bbc.co.uk/science/humanbody/body/factfiles/joints/ball_and_socket_joint.shtml
這個網站特別的地方就是它提供了一些小動畫,而且使用者可以控制關接的變動,不錯的學習工具。






第二題:



在說明我自己看法之前,我們先看看一些人對創意發明的看法。

Wallas(1926)提出其創造歷程觀點:
準備期、醞釀期、豁達期、驗證期,凡四階段。
Kenller(1965)提出其創造歷程觀點:
洞察問題、準備期、醞釀期、闡釋階段、確認階段,凡五階段。
Guilford(1967)提出其創造歷程觀點:
輸入資料、激發注意力、記憶的儲存及評價、再度輸入資料、知覺問題及組織、記憶的儲存及評價、試驗答案、產生答案、儲存在記憶中、新問題組織的測試、獲得新資料、記憶的儲存、新答案的測試、新答案的產生、記憶的儲存,凡十五階段。
Parnes(1967)提出其創造歷程觀點:
發現事實、發現問題、發現概念、發現解決方案、接受所發現的解決方案,凡五階段。
Olson(1980)提出其創造歷程觀點:
界定問題、接受各種可能解決的方案、提出最佳方案、付諸行動,凡四階段。
Ambile(1983)提出其創造歷程觀點:
提出問題、準備期、產生反應、測試各反應、結果,凡五階段。
Davis(1986)認為創造的歷程,可從以下幾個方面來定:
1.創意者用來解決問題的一些步驟或階段。
2.當新的主意或解決方案突然逬發的那一瞬間,是由於知覺的突然產生改變或轉換。
3.創意者有意無意間用來引發新的主意、關係、意義、知覺、轉換等的一些技巧和策略。
Isaksen & Parnes(1985)提出創造性的問題解決法其步驟為:
確定目標 (objective-finding)、尋找資料(data or fact-finding)(問題分析)、發現問題(problem-finding)(界定問題)、尋求主義(idea-finding)、尋求解決(solution-finding)、接受主義(acceptance-finding)六個階段





其實,大家都有一個共通點,就是問題的發現。我們現在學的一切東西,都是為了解決往後我們要面對的所有問題。大家的處事能力不會差很多,但是我們要如何與眾不同呢﹖就是靠設計了。
設計大置上可分為十人過程︰
問題需求、背景研究、目標陳述、性能規範、觀念形成與創造、分析、比較與選擇、細部設計、型機與試驗及生產製造。

我認為無論是創新,還是發明創造所遇到的問題,對其加以解決的思維方法都是相同相通的。創新與發明創造的能力既源於天賦,更來自於後天的教育培養,來自於通過各種形式的啟發和引導,包括從發明創造思維方法、認知障礙及其克服,到創新的非認知調控和創造性人格特徵分析等。總之,用一種新的方式、比較高的效率培養創新與發明創造型人才是我們希望達到的目的。

參考資料︰機動學 馮丁樹編著


第三題:





M=48+10;
x=1:1:10;
y=x.^(1/M);
plot(x,y);
xlabel('x'):ylabel('y');
title('張志鵬的圖')