下面我们来简单地介绍一下怎么样用matlab来绘制凸轮的工作轮廓线主要涉及解析法首先看一下理论轮廓线的方程式X=(S0+S1)sinθ+ecosθY=(S0+S1)cosθ+esinθ式中,e为偏心距,S0=sqrt(r0^2-e^2),r0为偏心圆半径只要在matlab的函数编辑中,输入一下代码即可我已经在程序中写了很详细的备注了,希望大家都能看懂附程序:%先设置凸轮的基本参数,偏心距离e,基圆半径rb,滚轮半径rr,角速度w,推杆上升的最大行程h。h=30;w=12;rb=50;e=12;rr=10;s0=sqrt(rb*rb-e*e);%偏心距e=12,基圆rb=50,滚轮半径rr=10,角速度w=12,最大上升h=30q=120*pi/180;%这里我规定推程运动角为120度qs=(120+30)*pi/180;%远休止角为150度q1=(120+30+150)*pi/180;%回程运动角为300度fori=1:1:120%将120度按1度均分,从而得到各个度数上的轮廓坐标qq(i)=i*pi/180.0;s1=(h*qq(i)/q)-(h/(2*pi))*sin(2*pi*qq(i)/q);v1=w*(h/q)-(w*h/q)*cos(2*pi*qq(i)/q);x(i)=(s0+s1)*sin(qq(i))+e*cos(qq(i));y(i)=(s0+s1)*cos(qq(i))-e*sin(qq(i));%理论轮廓线的坐标a(i)=(s0+s1)*cos(qq(i))-e*sin(qq(i));%cos(i)b(i)=(s0+s1)*sin(qq(i))-e*cos(qq(i));%sin(i)xx(i)=x(i)+rr*b(i)/sqrt(a(i)*a(i)+b(i)*b(i));yy(i)=y(i)+rr*a(i)/sqrt(a(i)*a(i)+b(i)*b(i));%实际工作轮廓线的坐标endfori=121:1:150qq(i)=i*pi/180;s2=h;v2=0;x(i)=(s0+s2)*sin(qq(i))+e*cos(qq(i));y(i)=(s0+s2)*cos(qq(i))-e*sin(qq(i));a(i)=(s0+s2)*cos(qq(i))-e*sin(qq(i));b(i)=(s0+s2)*sin(qq(i))-e*cos(qq(i));xx(i)=x(i)+rr*b(i)/sqrt(a(i)*a(i)+b(i)*b(i));yy(i)=y(i)+rr*a(i)/sqrt(a(i)*a(i)+b(i)*b(i));endfori=151:1:300qq(i)=i*pi/180;qq1(i)=qq(i)-150*pi/180;s3=h-h*qq1(i)/(q1-qs);v3=-w*h/(q1-qs);x(i)=(s0+s3)*sin(qq(i))+e*cos(qq(i));y(i)=(s0+s3)*cos(qq(i))-e*sin(qq(i));a(i)=(s0+s3)*cos(qq(i))-e*sin(qq(i));b(i)=(s0+s3)*sin(qq(i))-e*cos(qq(i));xx(i)=x(i)+rr*b(i)/sqrt(a(i)*a(i)+b(i)*b(i));yy(i)=y(i)+rr*a(i)/sqrt(a(i)*a(i)+b(i)*b(i));endfori=301:1:360qq(i)=i*pi/180;x(i)=(s0+0)*sin(qq(i))+e*cos(qq(i));y(i)=(s0+0)*cos(qq(i))-e*sin(qq(i));a(i)=(s0+0)*cos(qq(i))-e*sin(qq(i));b(i)=(s0+0)*sin(qq(i))-e*cos(qq(i));xx(i)=x(i)+rr*b(i)/sqrt(a(i)*a(i)+b(i)*b(i));yy(i)=y(i)+rr*a(i)/sqrt(a(i)*a(i)+b(i)*b(i));endplot(x,y,'r',xx,yy,'g')%用plot函数绘制曲线text(0,20,'理论轮廓线')%理论轮廓线的坐标位于为(0,20)text(65,40,'实际轮廓线')%实际轮廓线的坐标位于(65,40)holdon附图: