当前位置:文档之家› matlab凸轮轮廓线设计和速度加速度分析

matlab凸轮轮廓线设计和速度加速度分析

e=input('Please input e:'); %输入偏心距
h=input('Please input h:'); %输入H
r=input('Please input r:'); %输入基圆半径
j1=input('Please input j1:'); %输入j1,j2,j3,j4
j2=input('Please input j2:'); j3=input('Please input j3:'); j4=input('Please input j4:');
x0=[]; %定义空数组x0,y0,v0,a0,m0,j0为以后数据输入提供空间
y0=[]; v0=[]; a0=[]; m0=[]; j0=[];
s0=sqrt(r*r-e*e)
for j=0:1:360 %定义角度的循环
s1=h/2*(1-cos(pi/j1*j)); %定义s1,s2,s3,s4的表达式
s2=h;
s3=h-(h/2)*(1-cos(pi/j3*j));
s4=0;
and if(j>360-j4)&&(j<=360) %判断角度范围确定对应的表达式
s=s4; %选择位移公式
v=0; %选择速度公式
a=0; %选择加速度公式
else if j>(360-j4-j3)&&j<=(360-j4) %接下来得三个条件语句也是同样的
s=s3;
v=-90*h/j3*sin(pi*j/j3);
a=-90*180*h/j3/j3*cos(pi*j/j3);
else if (j>360-j4-j3-j2)&&(j<=360-j4-j3)
s=s2; v=0; a=0;
else s=s1;
v=90*h/j1*sin(pi*j/j1); a=180*90*h/j1/j1*cos(pi*j/j1);
end
x=e*cos(j/180*pi)+(s0+s)*sin(j/180*pi); %定义凸轮轮廓的横坐标 y=(s0+s)*cos(j/180*pi)-e*sin(j/180*pi); %定义凸轮轮廓的纵坐标
x0=[x0,x]; %将数据输入到数组中
x0,y0,v0,a0,m0,j0
y0=[y0,y]; %其中x0存储凸轮横坐标,y0存储凸轮纵坐标存 v0=[v0,v]; %v0储角度对应速度存
a0=[a0,a]; %a0储角度对应加速度,m0存储角度对应位移
m0=[m0,s]; j0=[j0,j]; end
subplot(2,2,1) %将平面分为四个区现在输出1区图象
plot(r*sin(j0),r*cos(j0)) %画出基圆的图形
hold on; %在图中继续加载图形
plot(x0,y0) %画出凸轮轮廓
axis([-100,100,-100,60]); %定义横纵坐标的范围
xlabel('轮廓曲线'); %定义下标名称
subplot(2,2,2) %输出2区图象
plot(j0,m0) %画出位移曲线
axis([0,400,-100,100]); %定义横纵坐标区间
xlabel('位移曲线'); %下面相同程序同理
subplot(2,2,3)
plot(j0,v0) %画出速度曲线
axis([0,400,-100,100])
xlabel('速度曲线'); subplot(2,2,4)
plot(j0,a0) %画出加速度曲线
axis([0,400,-100,100])
xlabel('加速度曲线');









相关主题
文本预览
相关文档 最新文档