《Matlab在机械设计中的应用大作业.doc》由会员分享,可在线阅读,更多相关《Matlab在机械设计中的应用大作业.doc(34页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateMatlab在机械设计中的应用大作业Matlab在机械设计中的应用Matlab在机械设计中的应用 大作业1、试用解析综合法设计一个曲柄摇杆机构。已知机构行程速度变化系数,摇杆CD的长度,摆角,要求机构的最小传动角。确定曲柄摇杆机构各构件杆长调用函数的编制:function f=funct(x) k=1.25; theta=pi*(k-1)/(k+1); yg=250;
2、 pis=pi/6 gamin=2*pi/9f1=(x(2)+x(1)2+(x(2)-x(1)2-2*(x(2)+x(1)*(x(2)-x(1)*cos(theta)-(2*yg*sin(pis/2)2; f2=yg2+x(3)2-2*yg*x(3)*cos(x(4)-(x(2)-x(1)2; f3=yg2 +x(3)2-2*yg*x(3)*cos(x(4)+pis)-(x(2)+x(1)2; f4=yg2+x(2)2-2*yg*x(2)*cos(gamin)-(x(3)-x(1)2; f=f1;f2;f3;f4;主函数: x0=50 120 200 0.5; k=1.25; theta=pi
3、*(k-1)/(k+1); yg=250; gamin=2*pi/9; x=fsolve(funct,x0)求解结果:Equation solved.fsolve completed because the vector of funct values is near zeroas measured by the default value of the funct tolerance, andthe problem appears regular as measured by the gradient.x = 62.9934 105.9045 245.0702 0.17242、四连杆机构如图
4、1 所示,已知各构件的尺寸L1, L2, L3, L4及原动件1的角位移1和等角速度1,求构件2和3的角位移2 ,3,角速度2,3,角加速度2,3。解:设L1=304.8设定机架1长度,L2=101.6设定曲柄2长度,L3=254设定连杆3长度 ,L4=177.8设定摇杆4长度。% 曲柄摇杆机构运动分析 % (1)-为了计算连杆的输出角th3和摇杆的输出角th4 % 设定各杆的长度(单位:毫米)Ntrpss函数funct th3,th4=ntrpss(th,rs)L=sqrt(rs(1)*rs(1)+rs(2)*rs(2)-2*rs(1)*rs(2)*cos(th(1)+0.4867);phi
5、=asin(rs(2)*sin(th(1)+90)/L);beta=acos(rs(4)*rs(4)+L*L-rs(3)*rs(3)/(2*rs(4)*L);if beta0 beta=beta+pi;endth4=pi-phi-beta;th3=asin(rs(4)*sin(th4)-rs(2)*sin(th(1)-90.00)/rs(3);end主函数:clearrs(1)=304.8; rs(2)=101.6; rs(3)=254; rs(4)=177.8; dr=pi/180.0;% % 设定初始推测的输入 % 机构的初始位置 th(1)=0.0; th(2)=45*dr; th(3)
6、=135*dr; % 摇杆4的初始位置角可以用三角形的正弦定理确定 %th(3)=pi-asin(sin(th(2)*rs(3)/rs(4) dth=5*dr; for i=1:72 th3,th4=ntrps(th,rs); th34(i,:)=th(1)/dr th3/dr th4/dr; % th(1)=th(1)+dth; th(2)=th3; th(3)=th4; end subplot(2,2,1) plot(th34(:,1),th34(:,2),th34(:,1),th34(:,3);axis(0 360 0 170)grid xlabel(时间/秒)ylabel(从动件角位移
7、/度)title(角位移线图)text(110,110,摇杆4角位移)text(50,35,连杆3角位移)% (2)- - - - -计算连杆的角速度om3和摇杆的角速度om4% Setting initial conditionsom2=250; T=2*pi/om2; for i=1:72t=i*T/72;ct(2)=i*dth;A=-rs(3)*sin(th34(i,2)*dr) rs(4)*sin(th34(i,3)*dr);rs(3)*cos(th34(i,2)*dr) -rs(4)*cos(th34(i,3)*dr);B=om2*rs(2)*sin(ct(2);-om2*rs(2)
8、*cos(ct(2);om=inv(A)*B; om3=om(1);om4=om(2);om34(i,:)=t om3 om4; endsubplot(2,2,2) % plot(om34(:,1),om34(:,2),om34(:,1),om34(:,3)axis(0 0.026 -190 210)grid title(角速度线图)xlabel(时间/秒)ylabel(从动件角速度)text(0.001,170, 摇杆4角速度)text(0.013,130, 摇杆3角速度)% (3)- - - - - 计算连杆的角加速度a3和摇杆的角加速度a4a2=0; for i=1:72 t=i*T/7
9、2;c(2)=i*dth;C=-rs(3)*sin(th34(i,2)*dr) rs(4)*sin(th34(i,3)*dr);rs(3)*cos(th34(i,2)*dr) -rs(4)*cos(th34(i, 3)*dr);D(1)=a2*rs(2)*sin(c(2)+om22*rs(2)*cos(c(2)+om34(i,2)2*rs(3)*cos(th34(i,2)*dr)-om34(i,3)2*rs(4)*cos(th34(i,3)*dr);D(2)=-a2*rs(2)*cos(c(2)+om22*rs(2)*sin(c(2)+om34(i,2)2*rs(3)*sin(th34(i,2
10、)*dr)-om34(i,3)2*rs(4)*sin(th34(i,3)*dr);a=inv(C)*D; a3=a(1);a4=a(2);a34(i,:)=t a3 a4; endsubplot(2,2,3) plot(a34(:,1),a34(:,2),a34(:,1),a34(:,3)axis(0 0.026 -60000 80000)grid title(角加速度线图)xlabel(时间)ylabel(从动件加速度)text(0.003,62000,摇杆4角加速度)text(0.010,33000,摇杆3角加速度)disp 曲柄转角 连杆转角-摇杆转角-连杆角速度-摇杆角速度-连杆加速度
11、-摇杆加速度ydcs=th34(:,1),th34(:,2),th34(:,3),om34(:,2),om34(:,3),a34(:,2),a34(:,3);disp(ydcs)3、已知图中机构以下参数: 1)、各构件尺寸(5个长度);LAB=80mm, LBC=260mm, LCD=300mm, LCE=100mm, LEF=460mm。 2)、各构件重量及重心位置;G1=36N,S1在A点,G2=60N,S2在BC中点,G3=72N,S3在C点,G4=85N,S4在EF中点,G5=85N,S5在F点。 3)、各构件对重心的转动惯量(4个转动构件);I1=0.03kgm2,I2=0.08kg
12、m2,I3=0.1 kgm2,I4=0.12 kgm2。 4)、阻力:注意推程为正、回程为负;作用在滑块5上的水平阻力(生产阻力)Pr=-4000N。当回程时,Pr=50N。 5)、曲柄顺时针回转,n1=400r/min转动的转速(注意转速单位)用matlab求解:1) 滑块5的位移线图(s-)、速度线图(v-)、加速度线图(a-)。这里指曲柄转过的角度,曲柄从右边水平开始,逆时针计算角度02.2) 作原动件1的平衡力矩线图。3) 编写界面程序,要求当输入曲柄某一角度值时,可计算出所有运动副反力R12,R23, R34,R56, R61,R63。要求最低实现以下基本功能: 其他格式自定。cle
13、arrs(1)=0.19235; rs(2)=0.08; rs(3)=0.26; rs(4)=0.30; rs(5)=0.40;rs(6)=0.460;e=0.090;dr=pi/180.0000; th(1)=0.0000; th(2)=50.3800*dr; th(3)=75.3600*dr; dth=dr; for i=1:360 th3,th4=ntrpss(th,rs); th5=-asin(rs(5)*sin(th4)-e)/rs(6); s=0.170+rs(5)*cos(th4)+rs(6)*cos(th5); th34(i,:)=th(1)/dr th3/dr th4/dr
14、th5/dr s; th(1)=th(1)+dth; th(2)=th3; th(3)=th4; end om2=400;T=2*pi/om2; for i=1:360t=i*T/360;ct(2)=i*dth;A=-rs(3)*sin(th34(i,2)*dr) rs(4)*sin(th34(i,3)*dr);rs(3)*cos(th34(i,2)*dr) -rs(4)*cos(th34(i,3)*dr);B=om2*rs(2)*sin(ct(2);-om2*rs(2)*cos(ct(2);om=inv(A)*B; om3=om(1);om4=om(2);C=rs(6)*sin(th34(i
15、,4)*dr) 1;-rs(6)*cos(th34(i,4)*dr) 0;D=-om(2)*rs(5)*sin(th34(i,3)*dr);om(2)*rs(5)*cos(th34(i,3)*dr);on=inv(C)*D;om5=on(1);om6=on(2);om34(i,:)=t om3 om4 om5 om6; enda2=0; for i=1:360 t=i*T/360;c(2)=i*dth;E=-rs(3)*sin(th34(i,2)*dr) rs(4)*sin(th34(i,3)*dr);rs(3)*cos(th34(i,2)*dr) -rs(4)*cos(th34(i,3)*d
16、r);F(1)=a2*rs(2)*sin(c(2)+om2*om2*rs(2)*cos(c(2)+om34(i,2)*om34(i,2)*rs(3)*cos(th34(i,2)*dr)-om34(i,3)*om34(i,3)*rs(4)*cos(th34(i,3)*dr);F(2)=-a2*rs(2)*cos(c(2)+om2*om2*rs(2)*sin(c(2)+om34(i,2)*om34(i,2)*rs(3)*sin(th34(i,2)*dr)-om34(i,3)*om34(i,3)*rs(4)*sin(th34(i,3)*dr);a=inv(E)*F; a3=a(1);a4=a(2);
17、G=rs(6)*sin(th34(i,4)*dr) 1;-rs(6)*cos(th34(i,4)*dr) 0;H=-om34(i,3).*om34(i,3)*rs(5)*cos(th34(i,3)-om34(i,4).*om34(i,4)*rs(6)*cos(th34(i,4);-om34(i,3).*om34(i,3)*rs(5)*sin(th34(i,3)-om34(i,4).*om34(i,4)*rs(6)*sin(th34(i,4);b=inv(G)*H;b1=b(1);b2=b(2);a34(i,:)=t a3 a4 b1 b2; endsyms p1 p2 p3 p4 jsd1x
18、jsd1y jsd2x jsd2y jsd3x jsd3y jsd4x jsd4y jsd5x jsd5y F2x F2y M2 F3x F3y M3 F5x F5y M5 F6x F1 F2for i=1:360 t=i*T/360;p1=i*dth;om2=400;a2=0; jsd2x=-0.08*om2*om2*cos(p1)-0.13*(om34(i,2)*om34(i,2)*cos(th34(i,2)*dr)+a34(i,2)*sin(th34(i,2)*dr);jsd2y=-0.08*om2*om2*sin(p1)-0.13*(om34(i,2)*om34(i,2)*sin(th
19、34(i,2)*dr)+a34(i,2)*cos(th34(i,2)*dr);jsd3x=-0.3*(om34(i,3)*om34(i,3)*cos(th34(i,3)*dr)+a34(i,3)*sin(th34(i,3)*dr);jsd3y=-0.3*(om34(i,3)*om34(i,3)*sin(th34(i,3)*dr)+a34(i,3)*cos(th34(i,3)*dr);jsd4x=-0.4*om34(i,3)*om34(i,3)*cos(th34(i,3)*dr)-0.23*(om34(i,4)*om34(i,4)*cos(th34(i,4)*dr)+a34(i,4)*sin(t
20、h34(i,4)*dr);jsd4y=-0.4*om34(i,3)*om34(i,3)*sin(th34(i,3)*dr)-0.23*(om34(i,4)*om34(i,4)*sin(th34(i,4)*dr)+a34(i,4)*cos(th34(i,4)*dr);jsd5x=-0.4*om34(i,3)*om34(i,3)*cos(th34(i,3)*dr)-0.46*(om34(i,4)*om34(i,4)*cos(th34(i,4)*dr)+a34(i,4)*sin(th34(i,4)*dr);F2x=-60/9.8*jsd2x;F2y=-60/9.8*jsd2y;M2=-0.08*a3
21、4(i,2);F3x=-72/9.8*jsd3x;F3y=-72/9.8*jsd3y;M3=-0.1*a34(i,3);F5x=-85/9.8*jsd4x;F5y=-85/9.8*jsd4y;M5=-0.12*a34(i,4);F6x=-85/9.8*jsd5x;F1=4000.0;X=0 1 0 1 0 0 0 0 0 0 0 0 0 0 01 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.08*sin(p1) 0.08*cos(p1) 0 0 0 0 0 0 0 0 0 0 10 0 0 -1 0 1 0 0 0 0 0 0 0 0 00 0 -1 0 1 0 0
22、0 0 0 0 0 0 0 00 0 -0.13*sin(th34(i,2)*dr) 0.13*cos(th34(i,2)*dr) -0.13*sin(th34(i,2)*dr) 0.13*sin(th34(i,2)*dr) 0 0 0 0 0 0 0 0 00 0 0 0 0 -1 0 1 0 1 0 0 0 0 00 0 0 0 -1 0 1 0 1 0 0 0 0 0 00 0 0 0 0 0 0.3*sin(th34(i,3)*dr) -0.3*cos(th34(i,3)*dr) -0.1*sin(th34(i,3)*dr) -0.1*cos(th34(i,3)*dr) 0 0 0 0
23、 00 0 0 0 0 0 0 0 -1 0 1 0 0 0 00 0 0 0 0 0 0 0 0 -1 0 1 0 0 00 0 0 0 0 0 0 0 -0.23*sin(th34(i,4)*dr) 0.23*cos(th34(i,4)*dr) 0.23*sin(th34(i,4)*dr) 0.23*cos(th34(i,4)*dr) 0 0 00 0 0 0 0 0 0 0 0 0 0 -1 0 1 00 0 0 0 0 0 0 0 0 0 0 0 -1 0 0;Z=0 0 0 -F2y -F2x -M2 -F3y -F3x -M3 -F5x -F5y -M5 0 F6x+F1 0;t=X/Z;t15=t(15)power(i,:)=t t15;endplot(power(:,1),power(:,2)-