您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 其它行业文档 > 机械原理牛头刨床matlab源程序
七.Matlab编程及绘图clearall;clc;%初始条件theta1=linspace(-25.72,334.28,100);%单位度theta1=theta1*pi/180;%转换为弧度制W1=80*pi/30;%角速度单位rad/sH=0.6;%行程单位mL1=0.1605;%O2A的长度单位mL3=0.6914;%O3B的长度单位mL4=0.2074;%BF的长度单位mL6=0.370;%O2O3的长度单位mL6u=0.6572;%O3D的长度单位mZ=pi/180;%角度与弧度之间的转换dT=(theta1(3)-theta1(2))/W1;%时间间隔forj=1:100t(j)=dT*(j-1);%时间因素end%求解S3、Theta3、Theta4和SE四个变量S3=((L6)^2+(L1)^2-2*L6*L1*cos(theta1+pi/2)).^0.5;%求出O3A的值fori=1:100%求解角度theta3、Theta4和SE的长度theta3(i)=acos(L1*cos(theta1(i))/S3(i));theta4(i)=asin((L6u-L3*sin(theta3(i)))/L4);SE(i)=L3*cos(theta3(i))+L4*cos(theta4(i));end%求解完成%求解完成%求解VS3、W3、W4和VE四个变量fori=1:100J=inv([cos(theta3(i)),-S3(i)*sin(theta3(i)),0,0;sin(theta3(i)),S3(i)*cos(theta3(i)),0,0;0,-L3*sin(theta3(i)),-L4*sin(theta4(i)),-1;0,L3*cos(theta3(i)),L4*cos(theta4(i)),0]);K=J*W1*[-L1*sin(theta1(i));L1*cos(theta1(i));0;0];VS3(i)=K(1);W3(i)=K(2);W4(i)=K(3);VE(i)=K(4);end%求解完成%求解aS3、a3、a4、aE四个变量fori=1:100J=inv([cos(theta3(i)),-S3(i)*sin(theta3(i)),0,0;sin(theta3(i)),S3(i)*cos(theta3(i)),0,0;0,-L3*sin(theta3(i)),-L4*sin(theta4(i)),-1;0,L3*cos(theta3(i)),L4*cos(theta4(i)),0]);P=W1*W1*[-L1*cos(theta1(i));-L1*sin(theta1(i));0;0];M=[-W3(i)*sin(theta3(i)),-VS3(i)*sin(theta3(i))-S3(i)*W3(i)*cos(theta3(i)),0,0;W3(i)*cos(theta3(i)),VS3(i)*cos(theta3(i))-S3(i)*W3(i)*sin(theta3(i)),0,0;0,-L3*W3(i)*cos(theta3(i)),-L4*W4(i)*cos(theta4(i)),0;0,-L3*W3(i)*sin(theta3(i)),-L4*W4(i)*sin(theta4(i)),0];N=[VS3(i);W3(i);W4(i);VE(i)];K=J*(-M*N+P);aS3(i)=K(1);a3(i)=K(2);a4(i)=K(3);aE(i)=K(4);end%求解完成%动态静力分析%初始条件M4=22;M5=3;M6=52;Js4=0.9;Js5=0.015;Fc=1400;Ls4=0.5*L3;Ls5=0.5*L4;%给切削阻力赋值fori=1:100if((abs(SE(1)-SE(i))0.05*H&&abs(SE(1)-SE(i))0.95*H)&&(theta1(i)pi))Fc(i)=1400;elseFc(i)=0;endend%赋值完成%求解平衡力矩J4=Js4+M4*(0.5*L3)*(0.5*L3);%导杆对点O3的转动惯量fori=1:100Ekk(i)=(M6*VE(i)*VE(i)+Js5*W4(i)*W4(i)+M5*VE(i)*VE(i)+J4*W3(i)*W3(i))/2;%计算总动能enddEkk(1)=Ekk(1)-Ekk(100);%动能的改变量fori=2:100dEkk(i)=Ekk(i)-Ekk(i-1);%动能的改变量endfori=1:100MM(i)=(dEkk(i)+Fc(i)*abs(VE(i)))/W1;%求平衡力矩end%画图%画运动图figure(1);plot(t,theta3,'r');holdon;plotyy(t,theta4,t,SE);gridon;xlabel('时间t/s');ylabel('theta3、theta4(rad)');title('角度Theta3、theta4和位移SE');axis([0,0.75,-0.2,2]);figure(2);plot(t,W3,'r');holdon;gridon;plotyy(t,W4,t,VE);xlabel('时间t/s');ylabel('W3、W4(rad/s)');title('角度速度W3、W4和速度VE');axis([0,0.75,-5,3]);figure(3);plot(t,a3,'r');holdon;plotyy(t,a4,t,aE);gridon;xlabel('时间t/s');ylabel('a3、a4(rad/s/s)');title('角度加速度a3、a4和加速度aE');axis([0,0.75,-80,80]);%运动图画完%画反力图figure(4);plotyy(theta1,Fc,theta1,SE);xlabel('Theta1(时间t)');ylabel('Fc');axis([theta1(1),theta1(100),-50,1400]);title('切削阻力Fc与位移SE');gridon;figure(5);plotyy(theta1,MM,theta1,Fc);xlabel('Theta1(时间t)');ylabel('力矩');axis([theta1(1),theta1(100),-50,300]);title('平衡力矩');gridon;figure(6);plotyy(theta1,Ekk,theta1,SE);xlabel('Theta1(时间t)');ylabel('Fc');title('导杆、连杆和刨头的总动能');gridon;theta1(1)theta1(100)
本文标题:机械原理牛头刨床matlab源程序
链接地址:https://www.777doc.com/doc-4221943 .html