%清除所有数据
clc;
clear all;
%题目
disp ' ******** 对心直动滚子推杆盘形凸轮机构设计 ********'
disp '已知条件:'
disp ' 凸轮以等角速度逆时针回转'
disp ' 推杆在推程作等速规律运动,在回程作等加速等减速规律运动'
%条件赋值
ro=16.54;
rr=10;
e=0;
w=1;
h=20;
delta0=120;
delta01=60;
delta00=90;
delta02=90;
s0=sqrt(ro^2-e^2);
d1=delta0+delta01;
d2=delta0+delta01+delta00;
d120=delta0+delta01+delta00/2;
hd=pi/180; %弧度制
du=180/pi; %角度制
fprintf (1,' 基圆半径 ro = %.2f mm \n',ro)
fprintf (1,' 滚子半径 rr = %.2f mm \n',rr)
fprintf (1,' 推杆偏距 e = %.2f mm \n',e)
fprintf (1,' 推程行程 h = %.2f mm \n',h)
fprintf (1,' 推程运动角 δ0 = %.2f 度 \n',delta0)
fprintf (1,' 远休止角 δ01 = %.2f 度 \n',delta01)
fprintf (1,' 回程运动角 δ0’= %.2f 度 \n',delta00)
fprintf (1,' 近休止角 δ02 = %.2f 度 \n',delta02)
%等速运动推程
s=zeros(delta0);
ds=zeros(delta0);
d2s=zeros(delta0);
for delta=1:delta0
s(delta)=h*delta/delta0 ;
s=s(delta);
ds(delta)=h/(delta0*hd) ;
ds=ds(delta);
d2s(delta)=0;
d2s=d2s(delta);
end
%等加速回程
s=zeros(delta00);
ds=zeros(delta00);
d2s=zeros(delta00);
for delta=d1:d120
s(delta)=h-2*h*(delta-d1)*(delta-d1)/delta00/delta00;
s=s(delta);
ds(delta)=-4*h*(delta-d1)/delta00/(delta00*hd);
ds=ds(delta);
d2s(delta)=-4*h/(delta00*hd)/(delta00*hd);
d2s=d2s(delta);
end
%等减速回程
s=zeros(delta00);
ds=zeros(delta00);
d2s=zeros(delta00);
for delta=d120:d2
s(delta)=2*h*(delta00-delta+d1)*(delta00-delta+d1)/delta00/delta00;
s=s(delta);
ds(delta)=-4*h*(delta00-delta+d1)/delta00/(delta00*hd);
ds=ds(delta);
d2s(delta)=4*h/(delta00*hd)/(delta00*hd);
d2s=d2s(delta);
end
%绘制运动规律图
delta1=0:0.1:delta0;
s1=h*delta1/delta0;
v1=h.*w./(delta0.*hd);
a1=0;
delta2=delta0:0.1:d1;
s2=h;
v2=0;
a2=0;
delta3=d1:0.1:d120;
s3=h-2.*h.*(delta3-d1).*(delta3-d1)./delta00./delta00;
v3=-4.*h.*w.*(delta3-d1)./delta00./(delta00.*hd);
a3=-4.*h.*w.*w./(delta00.*hd)./(delta00.*hd);
delta4=d120:0.1:d2;
s4=2.*h.*(delta00-delta4+d1).*(delta00-delta4+d1)/delta00/delta00;
v4=-4.*h.*w.*(delta00-delta4+d1)/delta00/(delta00*hd);
a4=4.*h.*w.*w./(delta00.*hd)/(delta00.*hd);
delta5=d2:0.1:360;
s5=0;
v5=0;
a5=0;
subplot(321);
plot(delta1,s1,delta2,s2,delta3,s3,delta4,s4,delta5,s5,'LineWidth',1.5,'color','b');hold on;
plot([120 180],[20 20],'LineWidth',1.5,'color','b');hold on;
plot([270 360],[0 0],'LineWidth',1.5,'color','b');hold on;
axis([0 360 0 25]);
title('推杆位置线图');
xlabel('\delta (度)'); ylabel('s (mm)');
grid on;
subplot(323);
plot(delta1,v1,delta2,v2,delta3,v3,delta4,v4,delta5,v5,'LineWidth',1.5,'color','b'); hold on;
plot([0 120],[h.*w./(delta0.*hd) h.*w./(delta0.*hd)],'LineWidth',1.5,'color','b');hold on;
plot([120 180],[0 0],'LineWidth',1.5,'color','b');hold on;
plot([270 360],[0 0],'LineWidth',1.5,'color','b');hold on;
axis([0 360 -30 20]);
title('推杆速度线图');
xlabel('\delta (度)'); ylabel('\nu (mm/s)');
grid on;
subplot(325);
plot(delta1,a1,delta2,a2,delta3,a3,delta4,a4,delta5,a5,'LineWidth',1.5,'color','b'); hold on;
plot([0 120],[0 0],'LineWidth',1.5,'color','b');hold on;
plot([120 180],[0 0],'LineWidth',1.5,'color','b');hold on;
plot([180 225],[-4.*h.*w.*w./(delta00.*hd)./(delta00.*hd) -4.*h.*w.*w./(delta00.*hd)./(delta00.*hd)],'LineWidth',1.5,'color','b');hold on;
plot([225 270],[4.*h.*w.*w./(delta00.*hd)./(delta00.*hd) 4.*h.*w.*w./(delta00.*hd)./(delta00.*hd)],'LineWidth',1.5,'color','b');hold on;
plot([270 360],[0 0],'LineWidth',1.5,'color','b');hold on;
axis([0 360 -40 40]);
title('推杆加速度线图 ');
xlabel('\delta (度)'); ylabel('a(mm/s^2)');
grid on;
%计算凸轮理论廓线与实际廓线的直角坐标
disp ' '
disp ' 凸轮理论廓线与实际廓线的直角坐标'
n=360;
s=zeros(n);
ds=zeros(n);
r=zeros(n);
rp=zeros(n);
x=zeros(n);
y=zeros(n);
dx=zeros(n);
dy=zeros(n);
xx=zeros(n);
yy=zeros(n);
xa=zeros(n);
ya=zeros(n);
xxa=zeros(n);
yya=zeros(n);
for delta=1:n
if delta<=delta0
s(delta)=h*delta/delta0;s=s(delta);
ds(delta)=h/(delta0*hd);ds=ds(delta);
elseif delta>delta0&delta<=d1
s=h;ds=0;
elseif delta>d1&delta<=d120
s(delta)=h-2*h*(delta-d1)*(delta-d1)/delta00/delta00;s=s(delta);
ds(delta)=-4*h*(delta-d1)/delta00/(delta00*hd);ds=ds(delta);
elseif delta>d120&delta<=d2
s(delta)=2*h*(delta00-delta+d1)*(delta00-delta+d1)/delta00/delta00;s=s(delta);
ds(delta)=-4*h*(delta00-delta+d1)/delta00/(delta00*hd);ds=ds(delta);
elseif delta>d2&delta<=n
s=0;ds=0;
end
%理论廓线
xx(delta)=(s0+s)*sin(delta*hd)+e*cos(delta*hd);x=xx(delta);
yy(delta)=(s0+s)*cos(delta*hd)-e*sin(delta*hd);y=yy(delta);
%实际廓线
dx(delta)=(ds-e)*sin(delta*hd)+(s0+s)*cos(delta*hd);dx=dx(delta);
dy(delta)=(ds-e)*cos(delta*hd)-(s0+s)*sin(delta*hd);dy=dy(delta);
xxa(delta)=x+rr*dy/sqrt(dx^2+dy^2);xa=xxa(delta);
yya(delta)=y-rr*dx/sqrt(dx^2+dy^2);ya=yya(delta);
%凸轮轮廓向径
r(delta)=sqrt(x^2+y^2);
rp(delta)=sqrt(xa^2+ya^2);
end
%列表
disp ' 1.等速运动推程'
disp ' 凸轮转角 理论x 理论y 实际x 实际y'
for delta=10:10:delta0
E=[delta xx(delta) yy(delta) xxa(delta) yya(delta)];
disp(E)
end
disp ' 2.1.等加速回程'
disp ' 凸轮转角 理论x 理论y 实际x 实际y'
for delta=d1:10:d120
E=[delta xx(delta) yy(delta) xxa(delta) yya(delta)];
disp(E)
end
disp ' 2.2.等减速回程'
disp ' 凸轮转角 理论x 理论y 实际x 实际y'
for delta=d120:10:d2
E=[delta xx(delta) yy(delta) xxa(delta) yya(delta)];
disp(E)
end
disp ' 3.凸轮轮廓向径'
disp ' 凸轮转角 理论r 实际r'
for delta=10:10:n
E=[delta r(delta) rp(delta)];
disp(E)
end
%绘制图形
subplot(122);
plot(xx,yy,'r-.');hold on; %理论轮廓
axis([-40 40 -40 60])
axis equal
text(ro+h-1,0,'X')
text(0,ro+rr+30,'Y')
text(2,2,'O')
title('对心直动滚子推杆盘形凸轮机构设计')
plot([-(ro+h) (ro+h-2)],[0 0],'k');hold on; %横轴
plot([0 0],[-(ro+h) (ro+h+18)],'k');hold on; %纵轴
plot([e e],[0 (ro+rr)],'k--');hold on; %初始偏置位置
c=linspace(0,2*pi);
plot(ro*cos(c),ro*sin(c),'y');hold on; %基圆
plot(e*cos(c),e*sin(c),'c--');hold on; %偏距圆
plot(e+rr*cos(c),s0+rr*sin(c),'LineWidth',1.1,'color','k');
hold on; %滚子圆
plot(xxa,yya,'LineWidth',1.1,'color','k');hold on; %实际轮廓
plot(e+0.5*cos(c),s0+0.5*sin(c),'LineWidth',1.1,'color','k');hold on;
plot([0 0],[(ro+0.5) 50],'LineWidth',1.1,'color','k');hold on;
rectangle('Position',[-5,40,4,8],'Curvature',[0,0],'LineWidth',1.1);hold on;
plot([-5 -5],[40 48],'LineWidth',1.1,'color','w');hold on;
rectangle('Position',[1,40,4,8],'Curvature',[0,0],'LineWidth',1.1);hold on;
plot([5 5],[40 48],'LineWidth',1.1,'color','w');hold on;
plot([-4 -1],[40 43],'k');hold on;
plot([-5 -1],[41 45],'k');hold on;
plot([-5 -1],[43 47],'k');hold on;
plot([-5 -2],[45 48],'k');hold on;
plot([-5 -4],[47 48],'k');hold on;
plot([4 5],[40 41],'k');hold on;
plot([2 5],[40 43],'k');hold on;
plot([1 5],[41 45],'k');hold on;
plot([1 5],[43 47],'k');hold on;
plot([1 4],[45 48],'k');hold on; %推杆
plot(0.5*cos(c),0.5*sin(c),'LineWidth',1.1,'color','k');hold on;
plot([-1 -0.5*cos(45*hd)],[-1.5 -0.5*sin(45*hd)],'LineWidth',1.1,'color','k');hold on;
plot([0.5*cos(45*hd) 1],[-0.5*sin(45*hd) -1.5],'LineWidth',1.1,'color','k');hold on;
plot([-1.5 1.5],[-1.5 -1.5],'LineWidth',1.1,'color','k');hold on;
plot([-1.5 -0.75],[-2.25 -1.5],'k');hold on;
plot([-0.75 0],[-2.25 -1.5],'k');hold on;
plot([0 0.75],[-2.25 -1
评论0