Double Pendulum-2
Double Pendulum-2
θ1
L1
y1 m1
L2
θ2
m2
y2
In my project I will model the behavior a system consisting of a pendulum hanging from
a point with another pendulum attached to the weight at the end of the first pendulum. Home Page
I will also calculate the energy in the system. In short, I will investigate and attempt to
model this system using differential equations. Title Page
JJ II
1. Variables and Parameters
My double pendulum system will consist of two masses connected by weightless bars. The top J I
bar will have length L1 and mass at the end of this bar will have mass m1 . The bar attached to
this mass will have length L2 and the mass attached the end of this second bar will have mass Page 1 of 17
m2 . I will call the point from which the first pendulum, the pendulum with length L1 and mass
m1 , pivots point O. I will let the angle that the first bar makes with a vertical line drawn down Go Back
from O be represented by θ1 and I will let the angle that the second bar makes with a vertical
line drawn down from m1 be represented by θ2 , where counter-clockwise angles are positive. If
Full Screen
I set this system in an xy-plane with O being the origin, I can find the position of the masses.
I am also going to let the x-position of m1 to be x1 and the y-position of m1 to be y1 . The x
and y position of m2 will be x2 and y2 . This gives me this list of variables and parameters that Close
correspond to the labels on figure 1:
Quit
x1 x2
O
θ1
L1
y1 m1
L2
θ2
m2
y2
Home Page
y1 m1
L2 Title Page
θ2
m2 JJ II
J I
y2
Page 2 of 17
Go Back
Figure 1: double pendulum
Full Screen
Close
Quit
x1 x2
O
θ1
L1
• the point O is the origin and is where the first pendulum pivots from Energy in the System
Using a Lagrangian
• angle made by the bar of the first pendulum and the line of rest = θ1 Numerical Results . . .
• angle made by the bar of the second pendulum and the line of rest = θ2 Conclusion
Matlab GUI
• the x-position of m1 = x1
• the y-position of m1 = y1 Home Page
• the x-position of m2 = x2
Title Page
• the y-position of m2 = y2
I am also going to let K represent the kinetic energy in the system and P represent the JJ II
potential or gravitational energy of the system.
J I
It is very simple to find equations for the x-position and the y-position of the first mass using
trigonometry: Go Back
x1 = L1 sin(θ1 )
Full Screen
y1 = −L1 cos(θ1 )
To find the position of the second mass I simply add to the position of the first mass. Close
x2 = x1 + L2 sin(θ2 )
Quit
x1 x2
O
θ1
L1
y2
So I get these formulas for the position of the masses of the pendula: Numerical Results . . .
Conclusion
x1 = L1 sin(θ1 ) (2) Matlab GUI
y1 = −L1 cos(θ1 ) (3)
x2 = L1 sin(θ1 ) + L2 sin(θ2 ) (4) Home Page
θ1
L1
I must now look at the energy in my double pendulum. This system has two different forms of y2
energy: kinetic energy (the energy of motion) and potential or gravitational energy (the energy
available to the system caused by the pull of gravity). The gravitational energy of this system Variables and Parameters
is the gravitational energy in the first pendulum plus the gravitational energy in the second
Position of Masses
pendulum. Thus I get
Energy in the System
P = m1 gy1 + m2 gy2 ,
Using a Lagrangian
where P is the potential energy of the system. With substitution from equation (3) and equa- Numerical Results . . .
tion (5) I get Conclusion
P = −(m1 + m2 )gL1 cos(θ1 ) − m2 L2 g cos(θ2 ) (14) Matlab GUI
I must now calculate the kinetic energy of the system. Like with potential energy the total
kinetic energy is the sum of the kinetic energies of the two pendula. Home Page
1
K= m(ẋ2 + ẏ 2 ). (15) Title Page
2
This brings me to this formula for the kinetic energy of the system:
JJ II
1 1
K = m1 (ẋ21 + y˙1 2 ) + m2 (ẋ22 + ẏ22 ).
2 2 J I
Using equations (10), (11), (12) and (13) I get
Page 5 of 17
1
K = m1 (L21 cos2 (θ1 )θ̇12 + L21 sin2 (θ1 )θ̇12 )+
2
Go Back
1
m2 [L21 cos2 (θ1 )θ̇12 + 2L1 L2 cos(θ1 ) cos(θ2 )θ̇1 θ̇2 + L22 cos2 (θ2 )θ̇22 +
2
L21 sin2 θ1 θ̇12 + 2L1 L2 sin θ1 sin θ2 θ̇1 θ̇2 + L22 sin2 (θ2 )θ̇22 ]. Full Screen
Close
Quit
x1 x2
O
θ1
L1
This simplifies to y1 m1
L2
θ2
m2
1
K = m1 L21 θ̇12 (cos2 (θ1 ) + sin2 (θ1 ))+ y2
2
1
m2 [L21 θ˙12 (cos2 (θ1 ) + sin2 (θ1 )) + L22 θ̇22 (cos2 (θ2 ) + sin2 (θ2 ))+ Variables and Parameters
2
Position of Masses
2L1 L2 θ̇1 θ̇2 (cos(θ1 ) cos(θ2 ) + sin(θ1 ) sin(θ2 )].
Energy in the System
The Lagrangian(L) of a system is the kinetic energy of the system minus the potential energy.
Title Page
This gives me
L = K − P. (17) JJ II
Using equations (16) and (14) I get
J I
1 1
L= m1 (θ̇1 L1 )2 + m2 [(θ̇1 L1 )2 + (θ̇2 L2 )2 + 2θ̇1 L1 θ̇2 L2 cos(θ1 − θ2 )]− Page 6 of 17
2 2 (18)
[−(m1 + m2 )gL1 cos(θ1 ) − m2 L2 g cos(θ2 )].
Go Back
Simplifying I get
Full Screen
1 1
L = (m1 + m2 )L21 θ̇12 + m2 L22 θ̇22 + m2 L1 L2 θ̇1 θ̇2 cos(θ1 − θ2 )+
2 2 (19) Close
(m1 + m2 )gL1 cos(θ1 ) + m2 L2 g cos(θ2 ).
Quit
x1 x2
O
θ1
L1
d ∂L ∂L
− =0 (20) y2
dt ∂ θ̇ ∂θ
For θ1 I get Variables and Parameters
Position of Masses
Energy in the System
∂L
= m1 L21 θ̇1 + m2 L21 θ̇1 + m2 L1 L2 θ̇2 cos(θ1 − θ2 ) (21) Using a Lagrangian
∂ θ̇1
Numerical Results . . .
d ∂L
= (m1 + m2 )L21 θ̈1 + m2 L1 L2 θ̈2 cos(θ1 − θ2 ) Conclusion
dt ∂ θ̇1
Matlab GUI
− m2 L1 L2 θ̇2 sin(θ1 − θ2 )(θ̇1 − θ̇2 (22)
∂L Home Page
= −L1 g(m1 + m2 ) sin(θ1 ) − m2 L1 L2 θ̇1 θ̇2 sin(θ1 − θ2 ). (23)
∂θ1
Title Page
Substituting equations (21), (22), and (23) into the Euler-Lagragnge (equation (20)) I get
Close
Quit
x1 x2
O
θ1
L1
y1 m1
L2
θ2
∂L m2
∂ θ̇2
d ∂L
= m2 L22 θ̈2 + m2 L1 L2 θ̈1 cos(θ1 − θ2 ) − m2 L1 L2 θ̇1 sin(θ1 − θ2 )(θ̇1 − θ̇2 ) (26) Variables and Parameters
dt ∂ θ̇2 Position of Masses
∂L Energy in the System
= m2 L1 L2 θ̇1 θ̇2 sin(θ1 − θ2 ) − L2 m2 g sin(θ2 ). (27)
∂θ2 Using a Lagrangian
Like with θ1 substituting equations (25), (26), and (27) into the Euler-Lagrange (equa- Numerical Results . . .
This gives me an equation for θ̈1 that depends on θ̈2 and an equation for θ̈2 that depends
on θ̈1 . I can use these two equations to make two more equations that have either θ̈1 or θ̈2 in Go Back
them but not both.
Substituting equation (28) into equation (24) I get Full Screen
" #
−L1 θ̈1 cos(θ1 − θ2 ) + L1 θ̇12 sin(θ1 − θ2 ) − g sin(θ2 )
θ̈1 (m1 + m2 )L1 = −m2 L2 cos(θ1 − θ2 )− Close
L2
m2 L2 θ̇22 sin(θ1 − θ2 ) − (m1 + m2 )g sin(θ1 ). Quit
x1 x2
O
θ1
L1
If I move all the terms that contain θ̈1 in them to the left hand side I get y1 m1
L2
θ2
m2
y2
gm2 sin(θ2 ) cos(θ1 − θ2 ) − m2 L2 θ̇22 sin(θ1 − θ2 ) − (m1 + m2 )g sin(θ1 ). Variables and Parameters
Position of Masses
After solving for θ̈1 , I get Energy in the System
Using a Lagrangian
−m2 L1 θ̇12 sin(θ1 − θ2 ) cos(θ1 − θ2 ) + gm2 sin(θ2 ) cos(θ1 − θ2 )
Numerical Results . . .
−m2 L2 θ̇22 sin(θ1 − θ2 ) − (m1 + m2 )g sin(θ1 ) Conclusion
θ̈1 = . (29)
L1 (m1 + m2 ) − m2 L1 cos2 (θ1 − θ2 ) Matlab GUI
Bringing all terms that have θ̈2 in them to the left hand side and factoring I get J I
L2 (m1 + m2 ) − m2 L2 cos2 (θ1 − θ2 ) m2 L2 θ̇22 sin(θ1 − θ2 ) cos(θ1 − θ2 )
θ̈2 = + Page 9 of 17
m1 + m2 m1 + m2
g sin(θ1 ) cos(θ1 − θ2 ) + L1 θ̇12 sin(θ1 − θ2 ) − g sin(θ2 ).
Go Back
θ1
L1
I now have two second order differential equations that I will be able make into four first y1 m1
L2
order differential equation. Setting up different variables for θ1 , θ2 ,θ̇1 ,θ̇2 I get this system: θ2
m2
y2
θ1
L1
m2 L2 z42
m2
θ1
L1
2
θ1 0 m2 y1 m1
L2
1.5 m1 θ2
θ2 m2
1
−0.5 y2
0.5
y1 and y2
θ1 and θ2
0 −1
Variables and Parameters
−0.5
−1.5 Position of Masses
−1
Energy in the System
−1.5
−2
−2
Using a Lagrangian
0 1 2 3 4 5 −1 −0.5 0 0.5 1 1.5
t x1 and x2 Numerical Results . . .
Conclusion
Figure 2: the position of m1 and m2 Figure 3: the position of m1 and m2 Matlab GUI
over time over time
Home Page
t1prime=0;
t2prime=0; Title Page
m1=2;
m2=1;
JJ II
L1=1;
L2=1;
g=9.81; J I
[t,z]=ode45(@Pend,[0,5],[t1;t2;t1prime;t2prime],[],m1,m2,L1,L2,g);
Page 12 of 17
I would like to be able to plot the position of the two masses as time goes forward so that
I can check to see if my numerical solution is reasonable so I use equations (2), (3), (4) and
Go Back
(5), replacing θ1 with the first column of z and θ2 with the second column of z. So I add this
Matlab code:
Full Screen
x1=L1*sin(z(:,1));
y1=-L1*cos(z(:,1));
x2=L1*sin(z(:,1))+L2*sin(z(:,2)); Close
y2=-L1*cos(z(:,1))-L2*cos(z(:,2));
Quit
x1 x2
O
θ1
L1
m1 m1 y1 m1
1 0.5 L2
m2 m2 θ2
m2
0.5 0 y2
y1 and y2
y1 and y2
0 −0.5
In order to see the numerical results I will plot θ1 versus time, θ2 versus time and, in order
to see that actual motion of the bobs on the two pendulums I will plot x1 verses y1 and x2 Title Page
verses y2 on the same axes. So I will add this code to my script file:
This Matlab code yields figure 2 and 3.
JJ II
6. Conclusion J I
There are three different types of behavior exhibited by this system: chaotic, semi-cyclical
and cyclical. Here are some examples. Figure 4 and 5 are examples of chaotic motion of the Go Back
double pendulum system. Figures 6 and 7 are examples of quasi-cyclical behavior of the system.
Figures 8 and 9 are examples of cyclical behavior in the system. Full Screen
Close
Quit
x1 x2
O
θ1
L1
y1 m1
L2
θ2
m2
2 2
m1 m1 y2
1.5 m2 1.5 m2
1 1
y1 and y2
0 0 Position of Masses
−0.5 −0.5 Energy in the System
−1 −1 Using a Lagrangian
−1.5 −1.5
Numerical Results . . .
−2 −1 0 1 2 −2 −1 0 1 2 Conclusion
x1 and x2 x1 and x2
Matlab GUI
Title Page
JJ II
m1 m1
m2 1.5 m2
1.5
1
1
J I
0.5
y1 and y2
y1 and y2
0.5 0
Page 14 of 17
−0.5
0
−1
−0.5
−1.5 Go Back
−2
−1.5 −1 −0.5 0 0.5 1 1.5 −2 −1 0 1 2
x1 and x2 x1 and x2
Full Screen
Quit
x1 x2
O
θ1
L1
2 m1 y1 m1
L2
m1 1.5 m2 θ2
1.5 m2
m2
1
y2
1
0.5
y1 and y2
0.5
y1 and y2
0
0 Variables and Parameters
−0.5
−0.5 Position of Masses
−1
−1 Energy in the System
−1.5
−1.5
Using a Lagrangian
−2 −1 0 1 2
−2 −1 0 1 2 x1 and x2 Numerical Results . . .
x1 and x2
Conclusion
Figure 11: the position of m1 and m2 Matlab GUI
Figure 10: the position of m1 and m2
over time with L1 = .93 and L2 =
over time with L1 = 1 and L2 = 1
1.05 Home Page
Another characteristic of this system is that small changes in the initial conditions of the system
can produce drastic changes in the behavior of the second mass. With L1 = 1, L2 = 1, the JJ II
initial angles θ1 and θ2 set at just a tiny bit under π I get the behavior shown in figure 10 but if I
5 7
increase the length of L2 by 100 and decrease L1 by 100 I get the behavior observed in figure 11. J I
One of these examples exhibits quasi-cyclical behavior while the other shows completely chaotic
behavior.
Page 15 of 17
Go Back
Full Screen
Close
Quit
x1 x2
O
θ1
L1
7. Matlab GUI y1 m1
L2
θ2
m2
I also made a Matlab GUI that animates my double pendulum model. The user can vary the y2
length of the pendulum bars, the mass of the pendulum bobs, the initial θ1 , θ2 , θ˙1 and θ˙2 values,
the time span and the number of points used by ode45 to generate the numeric values for the Variables and Parameters
animation. A large number of points will cause the animation to proceed slower and a small
Position of Masses
number of points will cause the animation to speed up. This GUI can be accessed at:
Energy in the System
http://online.redwoods.cc.ca.us/instruct/darnold/DEProj/sp08/jaltic/ Using a Lagrangian
DoublePendulumAnimation.zip Numerical Results . . .
Conclusion
Matlab GUI
Home Page
Title Page
JJ II
J I
Page 16 of 17
Go Back
Full Screen
Close
Quit
x1 x2
O
θ1
L1
References y1 m1
L2
θ2
m2
[1] Atam P. Arya Introduction To Classical Mechanics, Upper Saddle River, NJ: Prentice Hall, y2
1998.
Variables and Parameters
Position of Masses
Energy in the System
Using a Lagrangian
Numerical Results . . .
Conclusion
Matlab GUI
Home Page
Title Page
JJ II
J I
Page 17 of 17
Go Back
Full Screen
Close
Quit