2007年5月30日

5/30- 第十一次作業

作業十一 廖婉婷 b94611040


*本週(5/24)有來上課*


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

本題我們先採用講義上function dwell
計算出隨角度改變之高度,速度,加速度值
再利用plot_dwell函式繪出關係圖
以下為函式內容:
function [y,yy,yyy]=dwell(ctheta,range,pattern)
%ctheta= 需要計算之凸輪角度
%range= 升程及返程之範圍
%pattern= 運動型式
% 1:等速運動uniform 2:抛物線parabolic 3:簡諧simple harmonic
%     4:擺線cycloidal 5:多項式polynomial motion
d2r=pi/180;
theta=ctheta*d2r;range=range*d2r;
dim=length(ctheta);
y=zeros(size(ctheta));yy=y;yyy=y;
for i=1:dim
if theta(i)>=range(3) %for the last motion(downward)
mode=pattern(2);betax=2*pi-range(3);
switch mode,
case 1, [y(i),yy(i),yyy(i)]=uniform(theta(i), range(3),betax,-1);
case 2, [y(i),yy(i),yyy(i)]=parabolicm(theta(i), range(3),betax,-1);
case 3, [y(i),yy(i),yyy(i)]=harmonicm(theta(i), range(3),betax,-1);
case 4, [y(i),yy(i),yyy(i)]=cycloidm(theta(i), range(3),betax,-1);
case 5, [y(i),yy(i),yyy(i)]=polynorm(theta(i), range(3),betax,-1);
end;

elseif theta(i)>=range(2) % dewell on the top
y(i)=1;
elseif theta(i)>=range(1) % for the 1st motion(upward)
mode=pattern(1);betax=range(2)-range(1);
switch mode,
case 1, [y(i), yy(i), yyy(i)]=uniform(theta(i), range(1),betax,+1);
case 2, [y(i), yy(i), yyy(i)]=parabolicm(theta(i), range(1),betax,+1);
case 3, [y(i), yy(i), yyy(i)]=harmonicm(theta(i), range(1),betax,+1);
case 4, [y(i), yy(i), yyy(i)]=cycloidm(theta(i), range(1),betax,+1);
case 5, [y(i), yy(i), yyy(i)]=polynorm(theta(i), range(1),betax,+1);
end
end
end

由題目給定開始時先在0-100°區間滯留,然後提升後在200至260°區間滯留,
其餘由260°至360°則為返程。
也就是升程為100~200°,返程為260~360°
注意ctheta表現的方式
[x y]分別表示升程與返程之運動型式
由於題目限定升程為等加速度運動
而返程運動自訂
故分別列出[2 1] [2 2] [2 3] [2 4] [2 5]各項情況之結果
function plot_dwell(ctheta,s,pattern,range)
%ctheta= 凸輪角度
%pattern= 運動型式
% 1:等速運動uniform 2:抛物線parabolic 3:簡諧simple harmonic
%     4:擺線cycloidal 5:多項式polynomial motion
%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

1.升程:拋物線 返程:等速運動
axis([0 360 -180 180])
plot_dwell(0:10:360,8,[2 1],[100 200 260])
title('升程:拋物線 返程:等速運動')


2.升程:拋物線 返程:拋物線
axis([0 360 -180 180])
plot_dwell(0:10:360,8,[2 2],[100 200 260])
title('升程:拋物線 返程:拋物線')


3.升程:拋物線 返程:簡諧運動
axis([0 360 -180 180])
plot_dwell(0:10:360,8,[2 3],[100 200 260])
title('升程:拋物線 返程:簡諧運動')


4.升程:拋物線 返程:擺線運動
axis([0 360 -180 180])
plot_dwell(0:10:360,8,[2 4],[100 200 260])
title('升程:拋物線 返程:擺線運動')


5.升程:拋物線 返程:多項式
axis([0 360 -180 180])
plot_dwell(0:10:360,8,[2 5],[100 200 260])
title('升程:拋物線 返程:多項式')



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

本題使用講義pincam函式
另角度為0~360度 每10度作間隔
半徑r0 = 15
衝程s = 5
由於為垂直接觸 偏置量e = 0
從動件長度L = 10
凸輪順時針轉動故cw = -1
運動型式在此以上題之第一情況為代表
亦即升程為加速度運動 返程為等速運動
因此pattern = [2 1]
function [x,y]=pincam(cth,r0,s,e,L,range,pattern,cw)
%cth: 凸輪角度(deg)
%r0: 凸輪基圓半徑
%e: 偏置量
%s: 從動件衝程
%L: 從動件長度
%cw: 凸輪轉動方向(反時鐘為正,順時鐘為負)
%pattern: 運動型式
% 1:等速運動uniform 2:抛物線parabolic 3:簡諧simple harmonic
%     4:擺線cycloidal 5:多項式polynomial motion
%range: 升程及返程範圍
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

%由題目條件執行function
>> [x y]=pincam([0:10:360],15,5,0,10,[100 200 260],[2 1],-1)
title('從動件為梢形之凸輪工作曲線')

以下為結果:


Q:你能讓此凸輪迴轉嗎?

for i = 1:10:360;
[x y]=pincam(i,15,5,0,10,[120 180 210],[2 4],-1)
axis equal;
grid on;
end;

沒有留言: