平面连杆机构运动分析Word格式.docx
《平面连杆机构运动分析Word格式.docx》由会员分享,可在线阅读,更多相关《平面连杆机构运动分析Word格式.docx(31页珍藏版)》请在冰豆网上搜索。
yg=0.0417;
omega1=1;
alph1=0;
hd=pi/180;
du=180/pi;
t1=1:
10:
361;
theta2=1:
theta3=1:
theta5=1:
theta6=1:
omega2=1:
omega3=1:
omega5=1:
omega6=1:
alph2=1:
alph3=1:
alph5=1:
alph6=1:
xe=1:
ye=1:
V=1:
a=1:
theta1=0;
options=gaoptimset('
PopulationSize'
100,'
Generations'
10000,'
StallGenLimit'
500,'
TolFun'
1e-100);
theta0=ga(@(thet)weiyi_0(thet,theta1),4,options);
iftheta0
(1)<
theta0
(1)=theta0
(1)+2*pi;
end
iftheta0
(1)>
2*pi
theta0
(1)=theta0
(1)-2*pi;
iftheta0
(2)<
theta0
(2)=theta0
(2)+2*pi;
iftheta0
(2)>
theta0
(2)=theta0
(2)-2*pi;
iftheta0(3)<
theta0(3)=theta0(3)+2*pi;
iftheta0(3)>
theta0(3)=theta0(3)-2*pi;
iftheta0(4)<
theta0(4)=theta0(4)+2*pi;
iftheta0(4)>
theta0(4)=theta0(4)-2*pi;
%调用子函数Fun_jixie计算该六杆机构的各杆角位移、角速度、角加速度以及E点的角位移、角速度、角加速度
forn1=1:
361
theta1=(n1-1)*hd;
t1(n1)=theta1*du;
theta=fsolve(@(thet)weiyi(thet,theta1),theta0);
iftheta
(1)<
theta
(1)=theta
(1)+2*pi;
iftheta
(1)>
theta
(1)=theta
(1)-2*pi;
iftheta
(2)<
theta
(2)=theta
(2)+2*pi;
iftheta
(2)>
theta
(2)=theta
(2)-2*pi;
iftheta(3)<
theta(3)=theta(3)+2*pi;
iftheta(3)>
theta(3)=theta(3)-2*pi;
iftheta(4)<
theta(4)=theta(4)+2*pi;
iftheta(4)>
theta(4)=theta(4)-2*pi;
[xe(n1),ye(n1)]=weiyi_E(theta1,theta,l1,l2,l22);
[omega,alph]=Fun_jixie(theta1,omega1,l1,l2,l3,l5,l6,l22,theta);
[V(n1),a(n1)]=sudu_jasudu_E(omega
(1),alph
(1),theta,theta1,omega1,l1,l2,l22,alph1);
theta2(n1)=theta
(1);
theta3(n1)=theta
(2);
theta5(n1)=theta(3);
theta6(n1)=theta(4);
omega2(n1)=omega
(1);
omega3(n1)=omega
(2);
omega5(n1)=omega(3);
omega6(n1)=omega(4);
alph2(n1)=alph
(1);
alph3(n1)=alph
(2);
alph5(n1)=alph(3);
alph6(n1)=alph(4);
theta0=theta;
%绘制各杆件的角位移、角速度、角加速度
n2=1:
n1=1:
figure
(1);
%%%%%%
subplot(2,2,1)%绘制位移线图
plot((n1-1),theta2(n2)*du,'
r-'
(n1-1),theta3(n2)*du,'
g-'
(n1-1),theta5(n2)*du,'
y-'
(n1-1),theta6(n2)*du,'
k-'
'
LineWidth'
1.5);
title('
各杆角位移线图'
);
xlabel('
原动件1\theta_1/\circ'
ylabel('
角位移/\circ'
gridon;
holdon;
text(200,60,'
θ2'
text(200,150,'
θ3'
text(200,350,'
θ5'
text(200,260,'
θ6'
subplot(2,2,2)%绘制角速度线图
plot((n1-1),omega2(n2),'
(n1-1),omega3(n2),'
(n1-1),omega5(n2),'
(n1-1),omega6(n2),'
各杆角速度线图'
角速度/rad\cdots^{-1}'
subplot(2,2,3)%绘制角加速度线图
plot((n1-1),alph2(n2),'
(n1-1),alph3(n2),'
(n1-1),alph5(n2),'
(n1-1),alph6(n2),'
各杆角加速度线图'
角加速度/rad\cdots^{-2}'
%%%%%%%
%求E点的位移
figure
(2)
subplot(2,2,1)
plot(xe(n1),ye(n1),'
E的位移线图'
E在x方向位移'
E在y方向位移'
%求E点角速度与角加速度
subplot(2,2,2)%绘制E点角速度
plot((n1-1),V(n1),'
E点角速度'
E点角速度/rad\cdots^{-1}'
subplot(2,2,3)%绘制E点角加速度
plot((n1-1),a(n1),'
E点角加速度'
E点角加速度/rad\cdots^{-2}'
%将数据输出到Exel表shuju1.xls中
xlswrite('
E:
\机械原理大作业\平面六杆机构\Matlab程序\shuju3.xls'
t1(n1)'
sheet1'
A1'
theta2(n1)'
*du,'
B1'
theta3(n1)'
C1'
theta5(n1)'
D1'
theta6(n1)'
E1'
omega2(n1)'
F1'
omega3(n1)'
G1'
omega5(n1)'
H1'
omega6(n1)'
I1'
alph2(n1)'
J1'
alph3(n1)'
K1'
alph5(n1)'
L1'
alph6(n1)'
M1'
V(n1)'
N1'
a(n1)'
O1'
4.2从动件角位移,角速度,角加速度
function[omega,alph]=Fun_jixie(theta1,omega1,l1,l2,l3,l5,l6,l22,theta)
%从动件角位移
theta2=theta
(1);
theta3=theta
(2);
theta5=theta(3);
theta6=theta(4);
%计算从动件角速度
A=[-l2*sin(theta2),l3*sin(theta3),0,0;
l2*cos(theta2),-l3*cos(theta3),0,0;
-l22*sin(theta2-pi/3),-l3*sin(theta3),-l5*sin(theta5),l6*sin(theta6);
l22*cos(theta2-pi/3),l3*cos(theta3),l5*cos(theta5),-l6*cos(theta6)];
B=[l1*sin(theta1);
-l1*cos(theta1);
0;
0];
omega=A\(omega1*B);
omega2=omega
(1);
omega3=omega
(2);
omega5=omega(3);
omega6=omega(4);
%%%%%
%计算角从动件角加速度
At=[-l2*omega2*cos(theta2),l3*omega3*cos(theta3),0,0;
-l2*omega2*sin(theta2),l3*omega3*sin(theta3),0,0;
-l22*omega2*cos(theta2-pi/3),-l3*omega3*cos(theta3),-l5*omega5*cos(theta5),l6*omega6*cos(theta6);
-l22*omega2*sin(theta2-pi/3),-l3*omega3*sin(theta3),-l5*omega5*sin(theta5),l6*omega6*sin(theta6)];
Bt=[omega1*l1*cos(theta1);
omega1*l1*sin(theta1);
];
alph=A\(-At*omega+omega1*Bt);
4.3E点角速度,角加速度
function[V,a]=sudu_jasudu_E(omega,alph,theta,theta1,omega1,l1,l2,l22,alph1)
%求E点角速度
A=[-l1*sin(theta1),-l2*sin(theta
(2))+l22*sin(pi/3-theta
(1));
l1*cos(theta1),l2*cos(theta
(1))-l22*cos(pi/3-theta
(1))];
B=[omega1;
omega
(1)];
Vx=-l1*sin(theta1)*omega1-l2*sin(theta
(2))+l22*sin(pi/3-theta
(1))*omega
(1);
Vy=l1*cos(theta1)*omega1+l2*cos(theta
(1))-l22*cos(pi/3-theta
(1))*omega
(1);
V=sqrt(Vx^2+Vy^2);
%求E点角加速度
D1=[alph1;
alph
(1)];
D2=[-l1*cos(theta1)*omega1,-l2*cos(theta
(1))*omega
(1)-l22*cos(pi/3-theta
(1))*omega
(1);
-l1*sin(theta1)*omega1,-l2*sin(theta
(2))*omega
(1)+l22*sin(pi/3-theta
(1))*omega
(1)];
a1=A*D1+D2*B;
a=sqrt(a1
(1)^2+a1
(2)^2);
4.4E点位移
function[xe,ye]=weiyi_E(theta1,theta,l1,l2,l22)
xe=l1*cos(theta1)+l2*cos(theta
(1))+l22*cos(pi/3-theta
(1));
ye=l1*sin(theta1)+l2*sin(theta
(2))+l22*sin(pi/3-theta
(1));
5、计算结果
1-C
各杆角位移变化
主动杆1
从动杆2
从动杆3
从动杆5
从动杆6
/(°
)
0
35.6084
65.6281
207.9752
248.0929
10
30.8934
61.5375
194.8392
245.6683
20
27.0862
59.5197
185.6508
242.7925
30
24.2472
59.4280
179.3291
237.8174
40
22.2711
60.9068
174.5082
230.1716
50
21.0007
63.5668
169.5566
219.5693
60
20.2899
67.0707
162.6546
205.5980
70
20.0246
71.1528
152.0191
187.9072
80
20.1229
75.6089
136.6623
167.0176
90
20.5287
80.2819
118.6181
146.7459
100
21.2050
85.0474
102.4070
132.5408
110
22.1289
89.8033
90.2305
125.7210
120
23.2870
94.4630
81.3183
123.9271
130
24.6719
98.9507
74.4878
124.7856
140
26.2796
103.1990
68.9103
126.7727
150
28.1066
107.1472
64.1954
129.0116
160
30.1477
110.7413
60.0940
130.9266
170
32.3934
113.9345
56.4453
132.1274
180
34.8277
116.6874
53.1161
132.3493
190
37.4267
118.9678
49.9679
131.4342
200
40.1568
120.7503
46.8439
129.3229
210
42.9741
122.0147
43.5755
126.0459
220
45.8240
122.7435
40.0051
121.7036
230
48.6401
122.9190
36.0147
116.4381
240
51.3440
122.5200
31.5507
110.3952
250
53.8440
121.5184
26.6324
103.6769
260
56.0339
119.8763
21.3373
96.2852
270
57.7910
117.5442
15.7582
88.0633
280
58.9751
114.4610
9.9287
78.6388
290
59.4298
110.5579
3.6988
67.3608
300
58.9895
105.7702
356.5045
53.1802
310
57.4975
100.0632
346.8670
34.3210
320
54.8445
93.4802
331.2049
7.5042
330
51.0310
86.2118
302.1698
327.0469
340
46.2458
78.6793
258.9097
278.6551
350
40.9100
71.5539
227.0232
254.5326
360
207.9744
248.0919
各杆角加位移变化
/(rad/s)
-0.5086
-1.5567
-0.3234
-0.4292
-0.3058
-1.0981
-0.2238
-0.3315
-0.1005
-0.7553
-0.3786
-0.2382
0.0760
-0.5319
-0.6263
-0.1597
0.2131
-0.4595
-0.9068
-0.0969
0.3132
-0.5604
-1.2182
-0.0472
0.3832
-0.8498
-1.5798
-0.0072
0.4299
-1.3021
-1.9614
0.0260
0.4588
-1.7368
-2.1529
0.0546
0.4738
-1.7842
-1.7954
0.0803
0.4776
-1.4218
-1.0270
0.1043
0.4721
-1.0319
-0.3838
0.1272
0.4586
-0.7715
-0.0154
0.1497
0.4379
-0.6117
0.1604
0.1718
0.4108
-0.5087
0.2231
0.1935
0.3780
-0.4374
0.2155
0.2145
0.3401
-0.3851
0.1612
0.2343
0.2979
-0.34