3、运动仿真
3.1 SolidWorks运动仿真
3.1.1三维建模:
3.1.2仿真曲线如下:
第 5 页 共 29 页
3.2 simulink仿真
出图如下:
3.3 MATLAB编程
程序如下:
l1=250;l2=510;l3=500;l4=750;
l1=l1/1000;l2=l2/1000;l3=l3/1000;l4=l4/1000; %%
th0=60;%%杆1初始位置 th=deg2rad(th0);
第 6 页 共 29 页
m1=0.05221;m2=0.10421;m3=0.10221; w1=pi/3;%%初始速度 w1=(2*pi*12)/60 vr=[w1];
aw1=0;%%初始角加速度 l2_1=l2/2; t=1; g=[0;0];
for time=0:0.05:5 th1=th+w1*time;
A=2*l1*l3*sin(th1); B=2*l3*(l1*cos(th1)-l4);
C=l2^2-l1^2-l3^2-l4^2+2*l1*l4*cos(th1);
th3_2=2*atan((A+(A^2+B^2-C^2)^(1/2))/(B-C)); th3_1=2*atan((A-(A^2+B^2-C^2)^(1/2))/(B-C));
D=2*l1*l2*sin(th1); E=2*l2*(l1*cos(th1)-l4);
F=l2^2+l1^2-l3^2+l4^2-2*l1*l4*cos(th1);
th2_2=2*atan((D+(D^2+E^2-F^2)^(1/2))/(E-F)); th2_1=2*atan((D-(D^2+E^2-F^2)^(1/2))/(E-F));
th2=th2_1;th3=th3_1;
lx=l1*cos(th1)+l2_1*cos(th2); ly=l1*sin(th1)+l2_1*sin(th2);
J1(t)=(1/12)*m1*l1^2*(10^(-6)); J3(t)=(1/12)*m3*l3^2*(10^(-6)); J2(t)=(1/12)*m2*l2^2*(10^(-6));
w2(t)=w1*(l1/l2)*((sin(th1)*cos(th3)-cos(th1)*sin(th3))/(sin(th3)*cos(th2)-cos(th3)*sin(th2)));
w3(t)=w1*(l1/l3)*((sin(th1)*cos(th2)-cos(th1)*sin(th2))/(sin(th3)*cos(th2)-cos(th3)*sin(th2)));
aw2(t)=(l2*w2(t)^2*cos(th3-th2)-l3*w3(t)^2+l1*w1^2*cos(th3-th1))/(l2*(sin(th3)*cos(th2)-cos(th3)*sin(th2)));
aw3(t)=(l1*w1^2*cos(th1-th2)+l2*w2(t)^2-l3*w3(t)^2*cos(th3_1-th2))/(l3*(sin(th3)*cos(th2)-cos(th3)*sin(th2)));
第 7 页 共 29 页
vlx(t)=-l1*w1*sin(th1)-l2_1*w2(t)*sin(th2); vly(t)=l1*w1*cos(th1)+l2_1*w2(t)*cos(th2);
alx(t)=-l1*aw1*sin(th1)-l1*w1^2*cos(th1)-l2_1*aw2(t)*sin(th2)-l2_1*w2(t)^2*cos(th2); aly(t)=l1*aw1*cos(th1)-l1*w1^2*sin(th1)+l2_1*aw2(t)*cos(th2)-l2_1*w2(t)^2*sin(th2);
v1(:,t)=[-sin(th1);cos(th1)]*(l1/2)*w1;
a1(:,t)=[-w1^2*cos(th1)-aw1*sin(th1);-sin(th1)*w1^2+cos(th1)*aw1]*(l1/2);
v0(:,t)=[vlx(t);vly(t)]; w0=[w2(t)];
a0(:,t)=[alx(t);aly(t)]; aw0=[aw2(t)];
v3(:,t)=[-sin(th3);cos(th3)]*(l3/2)*w3(t);
a3(:,t)=[-w3(t)^2*cos(th3)-aw3(t)*sin(th3);-sin(th3)*w3(t)^2+cos(th3)*aw3(t)]*(l3/2);
G2=m2*g; f2=-m2*a0(:,t); n2=-J2(t)*aw2(t);
G1=m1*g; f1=-m1*a1(:,t); n1=-J1(t)*aw1;
G3=m3*g; f3=-m3*a3(:,t); n3=-J3(t)*aw3(t);
M(t)=-([f2'+G2' n2']*[v0(:,t);w0]+[f1'+G1' n1']*[v1(:,t);w1]+[f3'+G3' n3']*[v3(:,t);w3(t)])/vr;
t=t+1; end
time=0:0.05:5; plot(time,M);
所得曲线如下:
第 8 页 共 29 页
二、单自由度
给定单自由度系统参数,对单自由度无阻尼和有阻尼自振动系统进行计算,分别绘制无阻尼、小阻尼、临界阻尼和大阻尼响应曲线,并进行仿真;物体上施加一简谐力,绘制无阻尼和有阻尼状态下的受迫振动曲线,并进行仿真。
要求:仿真使用solidwoks和matlab/simulink同时进行。
第 9 页 共 29 页