凸轮运动Matlab仿真Matlab课程设计

  • 格式:doc
  • 大小:168.00 KB
  • 文档页数:3

下载文档原格式

  / 3
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Matlab 课程设计

李俊机自091

设计题目一:凸轮机构设计

已知轮廓为圆形的凸轮(圆的半径为100mm、偏心距为20mm),推杆与凸轮运动中心的距离20mm,滚子半径为10mm,请利用matlab仿真出凸轮推杆的运动轨迹和运动特性(速度,加速度),并利用动画演示出相关轨迹和运动特性。

%总程序代码

clc;

clf;

clear;

p=figure('position',[100 100 1200 600]);

for i=1:360

%画圆形凸轮

R=100; %圆形凸轮半径

A=0:0.006:2*pi;

B=i*pi/180;

e=20; %偏心距

a=e*cos(B);

b=e*sin(B);

x=R*cos(A)+a;

y=R*sin(A)+b;

subplot(1,2,1)

plot(x,y,'b','LineWidth',3);

%填充

fill(x,y,'y')

axis([-R-e,R+e,-R-e,R+e+100]);

set(gca,'Xlim',[-R-e,R+e])

set(gca,'Ylim',[-R-e,R+e+100])

axis equal;

axis manual;

axis off;

hold on;

plot(a,b,'og')

plot(e,0,'or')

plot(0,0,'or','LineWidth',3)

%画滚子

gcx=0; %滚子中心X坐标

r=10; %滚子半径

gcy=sqrt((R+r)^2-a^2)+b; %滚子中心Y坐标

gx=r*cos(A)+gcx; %滚子X坐标

gy=r*sin(A)+gcy; %滚子Y坐标

plot(gx,gy,'b','LineWidth',2);

%画其它部分

plot([0 a],[0 b],'k','LineWidth',4)

plot([3 3],[170 190],'m','LineWidth',4)

plot([-3 -3],[170 190],'m','LineWidth',4)

%画顶杆

gc=120;

dgx=[0 0];

dgy=[gcy gcy+gc];

plot(dgx,dgy,'LineWidth',4);

hold off

%画位移图

sx(i)=B;

sy(i)=gcy;

subplot(3,2,2)

plot(sx,sy,'b','LineWidth',3)

title('位移线图')

grid on

hold off;

%画速度图

vx(i)=B;

vy(i)=20*cos(B) + (40*cos(B).*sin(B))./(121 - 4*cos(B).^2).^(1/2);

subplot(3,2,4)

plot(vx,vy,'g','LineWidth',3)

title('速度线图')

grid on

hold off;

%画加速度图

ax(i)=B;

ay(i)=(40*cos(B).^2)./(121 - 4*cos(B).^2).^(1/2) - 20*sin(B) - (40*sin(B).^2)/(121 -4*cos(B).^2).^(1/2) - (160*cos(B).^2.*sin(B).^2)/(121 - 4*cos(B).^2).^(3/2); subplot(3,2,6)

plot(ax,ay,'r','LineWidth',3),xlabel('B')

title('加速度线图')

grid on

hold off;

M=getframe;

end

截图

附:通过求导求速度和加速度

%求速度

syms B;

a=e*cos(B);

b=e*sin(B);

s=sqrt((R+r).^2-a.^2)+b;

v=diff(s)

结果:v =20*cos(B) + (40*cos(B)*sin(B))/(121 - 4*cos(B)^2)^(1/2)

%求加速度

syms B;

v =20*cos(B) + (40*cos(B)*sin(B))/(121 - 4*cos(B)^2)^(1/2);

a=diff(v)

结果:a =(40*cos(B)^2)/(121 - 4*cos(B)^2)^(1/2) - 20*sin(B) - (40*sin(B)^2)/(121 - 4*cos(B)^2)^(1/2) - (160*cos(B)^2*sin(B)^2)/(121 - 4*cos(B)^2)^(3/2)