您好,欢迎访问三七文档
当前位置:首页 > 机械/制造/汽车 > 机械/模具设计 > 机械原理matlab分析大作业3-28
机械原理第一题:求C点的位移、速度及加速度。由封闭形ABCDEA与AEFA得:L6+L4+L3=L1+L2L1’=L6+L4’(1)位置分析机构的封闭矢量方程式写成在两坐标上的投影表达式:由以上方程求出θ2、θ3、θ4、L1’1.主程序:%输入已知数据l2=60;l3=35;l4=75;l5=50;l6=40;l7=70;hd=pi/180;du=180/pi;omega1=10;alpha1=0;%调用子函数计算角位移,角速度及角加速度forn1=1:66%曲柄转角范围theta1(n1)=(n1-1)*hd;ll=[l2,l3,l4,l5,l6,l7];[theta,omega,alpha]=six_bar(theta1(n1),omega1,ll);l1(n1)=theta(1);theta2(n1)=theta(2);theta4(n1)=theta(3);theta3(n1)=theta(4);v1(n1)=omega(1);omega2(n1)=omega(2);omega3(n1)=omega(3);omega4(n1)=omega(4);a1(n1)=alpha(1);alpha2(n1)=alpha(2);alpha3(n1)=alpha(3);alpha4(n1)=alpha(4);end%图像输出figure(1);n1=1:66;t=(n1-1)*2*pi/360;subplot(2,2,1);%滑块F线位移L1图像输出plot(theta1*du,l1,'k');title('L1线位移图');xlabel('角位移\theta_1/\circ')ylabel('线位移/mm')gridon;holdon;gtext('L1')pause(1);subplot(2,2,2);%theta2、theta3、theta4角位移图像输出plot(theta1*du,theta2*du,'g',theta1*du,theta3*du,'r',theta1*du,theta4*du);title('\theta_2、\theta_3、\theta_4角位移图');xlabel('角位移\theta_1/\circ')ylabel('角位移/\circ')gridon;holdon;legend('\theta_2','\theta_3','\theta_4');pause(1);subplot(2,2,3);%滑块F的速度图像输出plot(theta1*du,v1,'k');title('滑块F的速度图');xlabel('角位移\theta_1/\circ')ylabel('速度/mm\cdots^{-1}')gridon;holdon;gtext('v1')pause(1);subplot(2,2,4);%滑块F的加速度图像输出plot(theta1*du,a1,'k');title('滑块F的加速度图');axisauto;xlabel('角位移\theta_1/\circ')ylabel('加速度/mm\cdots^{-2}')gridon;holdon;gtext('a1');pause(5);figure(2);subplot(1,2,1);%omega2、omega3和omega4角位移图像输出plot(theta1*du,omega2,'g',theta1*du,omega3,'r',theta1*du,omega4,'b');title('\omega_2、\omega_3、\omega_4角速度图');axisauto;gridon;holdon;xlabel('角位移\theta_1/\circ')ylabel('角速度/rad\cdots^{-1}')boxon;legend('\omega_2','\omega_3','\omega_4');pause(1);subplot(1,2,2);%alpha2、alpha3和alpha4角加速度图像输出plot(theta1*du,alpha2,'g',theta1*du,alpha3,'r',theta1*du,alpha4,'b');title('\alpha_2、\alpha_3、\alpha_4角加速度图');axisauto;gridon;holdon;xlabel('角位移\theta_1/\circ')ylabel('角加速度/rad\cdots^{-2}')boxon;legend('\alpha_2','\alpha_3','\alpha_4');pause(5);figure(3);xC=-l6*cos(theta1+pi)+l5*cos(theta3);yC=l6*sin(theta1+pi)+l5*sin(theta3);%rC=sqrt(xC.*xC+yC.yC)vCX=-omega1*l6*sin(theta1+pi)-omega3*l5.*sin(theta3);vCY=omega1*l6*cos(theta1+pi)+omega3*l5.*cos(theta3);%v3=sqrt(vCX.*vCX+vCY.*vCY);subplot(2,2,1);holdon;gridon;%C点x、y方向位移图像输出plot(theta1*du,xC,'r',theta1*du,yC);axisauto;holdon;gridon;title('C点位移图');xlabel('角位移\theta_1/\circ')ylabel('位移/mm')gridon;holdon;legend('xC','yC');pause(1);subplot(2,2,2);gridon;holdon;%C点x、y方向速度图像输出plot(theta1*du,vCX,'k',theta1*du,vCY);title('C点速度图');xlabel('角位移\theta_1/\circ')ylabel('速度/mm\cdots^{-1}')legend('vCX','vCY');pause(1);aCX=omega1*omega1*l6*cos(theta1)-omega3.*omega3.*l5.*cos(theta3)-alpha3.*l5.*sin(theta3);aCY=omega1*omega1*l6*sin(theta1)-omega3.*omega3.*l5.*sin(theta3)+alpha3.*l5.*cos(theta3);%a3=sqrt(aCX.*aCX+aCY.*aCY);subplot(2,2,3);%C点x、y方向加速度图像输出plot(theta1*du,aCX,'r',theta1*du,aCY,'b');title('C点加速度图');gridon;holdon;xlabel('角位移\theta_1/\circ')ylabel('加速度/mm\cdots^{-2}')boxon;legend('aCX','aCY');%主程序结束2.子程序:%子函数function[theta,omega,alpha]=six_bar(theta1,omega1,ll)l2=ll(1);l3=ll(2);l4=ll(3);l5=ll(4);l6=ll(5);l7=ll(6);%1.计算角位移和线位移l1=l7*cos(theta1)+sqrt((l7*cos(theta1))*(l7*cos(theta1))-l7*l7+l2*l2);theta2=asin((l1*sin(theta1))/l2);A=2*l4*(l6*sin(theta1)-l3*sin(theta2).*sin(theta2));B=2*l4*(l6*cos(theta1)+l7-l3*cos(theta2));C=l4*l4-l5*l5+l6*l6+l7*l7+l3*l3-2*l3*l6*(cos(theta1)*cos(theta2)+sin(theta1)*sin(theta1))-2*l7*l3*cos(theta2)+2*l6*l7*cos(theta1);theta4=2*atan((A+sqrt(A.*A+B.*B-C.*C))/(B-C));theta3=asin((l6*sin(theta1)+l4*sin(theta4)-l3*sin(theta2))/l5);theta(1)=l1;theta(2)=theta2;theta(3)=theta4;theta(4)=theta3;%2利用矩阵计算角速度和线速度D=[-l5*sin(theta3),l4*sin(theta4),-l3*sin(theta2+pi),0l5*cos(theta3),-l4*cos(theta4),-l3*cos(theta2+pi),00,0,l2*sin(theta2),cos(theta1)0,0,-l2*cos(theta2),sin(theta1)];E=[l6*sin(theta1+pi);-l6*cos(theta1+pi);l1*sin(theta1);-l1*cos(theta1)];omega=D\(omega1*E);v1=omega(4);omega2=omega(3);omega3=omega(1);omega4=omega(2);%3利用矩阵计算角加速度和加速度Dt=[-l5*omega3*cos(theta3),l4*omega4*cos(theta4),-l3*omega2*cos(theta2),0-l5*omega3*sin(theta3),l4*omega4*sin(theta4),-l3*omega2*sin(theta2),00,0,l2*omega2*cos(theta2),-omega1*sin(theta1)0,0,l2*omega2*sin(theta2),omega1*cos(theta1)];Et=[l6*omega1*cos(theta1);l6*omega1*sin(theta1);l1*omega1*cos(theta1)+v1*sin(theta1);l1*omega1*sin(theta1)-v1*cos(theta1)];alpha=D\(-Dt*omega+omega1*Et);a1=alpha(4);alpha2=alpha(3);alpha3=alpha(1);alpha4=alpha(2);%3子程序结束3.图像输出:%1.滑块F线位移L1图像输出%2.theta2、theta3、theta4角位移图像输出%3.滑块F的速度图像输出%4.滑块F的加速度图像输出%5.omega2、omega3和omega4角位移图像输出%6.alpha2、alpha3和alpha4角加速度图像输出%7.C点x、y方向位移图像输出%8.C点x、y方向速度图像输出%9.C点x、y方向加速度图像输出
本文标题:机械原理matlab分析大作业3-28
链接地址:https://www.777doc.com/doc-6497882 .html