dynamics of a four-bar linkage a b c o 1 a matlab program for
TRANSCRIPT
Dynamics of a four-bar linkage
m18.0
m18.0
m26.0
m08.0
OC
BC
AB
OA
A
B
CO
mN1.0 T
24
23
25
mkg1086.4
mkg1046.1
mkg1027.4
BO
AB
OA
I
I
I
kg18.0
kg26.0
kg08.0
BC
AB
OA
M
M
M
2sm9.8g
1
A Matlab Program for
Mass matrix and external force vector
4
3
5
1086.400000000
00.180000000
000.18000000
0001046.100000
00000.260000
000000.26000
0000001027.400
000000008.00
0000000008.0
M
2sm9.8g
kg18.0
kg26.0
kg08.0
BC
AB
OA
M
M
M
24
23
25
mkg1086.4
mkg1046.1
mkg1027.4
BO
AB
OA
I
I
I
mN1.0 T
0
8.918.0
0
0
8.926.0
0
1.0
8.908.0
0
g
2
0
sin09.0
cos09.0
sin09.0sin13.0
cos09.0cos13.0
sin13.0sin05.0
cos13.0cos05.0
sin04.0
cos04.0
2
33
2
33
2
33
2
22
2
33
2
22
2
22
2
2
22
2
2
2
γ
Jacobian matrix and γ
000000100
cos09.010000000
sin09.001000000
cos09.010cos13.010000
sin09.001sin13.001000
000cos13.010cos04.010
000sin13.001sin04.001
000000cos04.010
000000sin04.001
3
3
32
32
2
2
99
J
m18.0
m18.0
m26.0
m08.0
OC
BC
AB
OA
3
Computation
9 8
8 9 8 8
9 1 8 1
In numerial computing, the first step is to solve
for 0 and 0 with initial position 0 and velocity 0 .
T
q gM J
λ γJ O
q λ q q
9 9 9 8
8 9 8 8
The objective is to solve the differential equation for .T
t
q gM Jq
λ γJ O
0Then integrate , and use and
0
to repeat the above step for and .
Δt ΔtΔt Δt
Δt
Δt Δt
q qq q
q q
q λ
Repeat until.t Δt
4
A convenient way with Matlab solver
Solve initial value problems for ordinary differential equations with ode45(commended), ode23, ode113…
The equations are described in the form of z‘=f(t,z)
q
qz
q
qz
,Let
3
1
1
3
1
1
y
x
y
x
5
The syntax for calling solver in Matlab
[T,Z] = ode45(@Func4Bar,[0:0.005:2],Z0);
column vector of time points
Solution array
A vector specifying the interval of integration
A vector of initial conditions
A function that evaluates the right side of the differential equations
function dz=Func4Bar(t,z) global L1 L2 L3 L4 torque gravity phi1=z(3); phi2=z(6); phi3=z(9);dphi1=z(12); dphi2=z(15); dphi3=z(18); M=diag([L1 L1 L1^3/12 L2 L2 L2^3/12 L3 L3 L3^3/12]); J=[ -1 0 -0.5*L1*sin(phi1) 0 0 0 0 0 0; 0 -1 0.5*L1*cos(phi1) 0 0 0 0 0 0; 1 0 -0.5*L1*sin(phi1) -1 0 -0.5*L2*sin(phi2) 0 0 0; 0 1 0.5*L1*cos(phi1) 0 -1 0.5*L2*cos(phi2) 0 0 0; 0 0 0 1 0 -0.5*L2*sin(phi2) -1 0 -0.5*L3*sin(phi3); 0 0 0 0 1 0.5*L2*cos(phi2) 0 -1 0.5*L3*cos(phi3); 0 0 0 0 0 0 1 0 -0.5*L3*sin(phi3); 0 0 0 0 0 0 0 1 0.5*L3*cos(phi3)]; 6
The syntax for calling solver in Matlab
J=[ -1 0 -0.5*L1*sin(phi1) 0 0 0 0 0 0; 0 -1 0.5*L1*cos(phi1) 0 0 0 0 0 0; 1 0 -0.5*L1*sin(phi1) -1 0 -0.5*L2*sin(phi2) 0 0 0; 0 1 0.5*L1*cos(phi1) 0 -1 0.5*L2*cos(phi2) 0 0 0; 0 0 0 1 0 -0.5*L2*sin(phi2) -1 0 -0.5*L3*sin(phi3); 0 0 0 0 1 0.5*L2*cos(phi2) 0 -1 0.5*L3*cos(phi3); 0 0 0 0 0 0 1 0 -0.5*L3*sin(phi3); 0 0 0 0 0 0 0 1 0.5*L3*cos(phi3)];
gamma=[ 0.5*L1*cos(phi1)*dphi1^2; 0.5*L1*sin(phi1)*dphi1^2; 0.5*L1*cos(phi1)*dphi1^2+0.5*L2*cos(phi2)*dphi2^2; 0.5*L1*sin(phi1)*dphi1^2+0.5*L2*sin(phi2)*dphi2^2; 0.5*L2*cos(phi2)*dphi2^2+0.5*L3*cos(phi3)*dphi3^2; 0.5*L2*sin(phi2)*dphi2^2+0.5*L3*sin(phi3)*dphi3^2; 0.5*L3*cos(phi3)*dphi3^2; 0.5*L3*sin(phi3)*dphi3^2]; g=[0 gravity*L1 torque 0 gravity*L2 0 0 gravity*L3 0]';
Matrix=[M J'; J zeros(size(J,1),size(J,1))];
d2q=Matrix\[g;gamma];
dz=[z(10:18,:); d2q(1:9,:)];7
Time response of displacement
1x
1
1y
2x
2
2y
3x
3
3y
t8
Time response of velocity
1x
1
1y
2x
2
2y
3x
3
3y
t9
Time response of acceleration
1x
1
1y
2x
2
2y
3x
3
3y
t
310
10
Time response of λ
1
t
310
2
3
4
5
6
7
8
11
A slider-crank mechanism
m2.0
m3.0
m2.0
m1.0
BO
GB
AG
AC
A
B
C
O
G
24
22
24
mkg1067.6
mkg1004.1
mkg1067.6
BO
AB
slider
I
I
I
kg2.0
kg5.0
kg1.0
BO
AB
AC
M
M
M
mN1.0 T
2sm9.8g
12
Time response of displacement
2x
2
2y
3x
3
3y
4x
4
4y
t13
Time response of velocity
2x
2
2y
3x
3
3y
4x
4
4y
t14
Time response of acceleration
2x
2
2y
3x
3
3y
t
4x
4
4y
310
15
Time response of λ
1
t
310
2
3
4
5
6
7
8
9
10
11
16