INOM
EXAMENSARBETE TEKNIK, GRUNDNIVÅ, 15 HP
STOCKHOLM SVERIGE 2019 ,
Simulated inverted
pendulum using analytical mechanics
CARL CLAUSON
MALTE SLOMA
INOM
EXAMENSARBETE TEKNIK, GRUNDNIVÅ, 15 HP
STOCKHOLM SVERIGE 2019 ,
Simulering av inverterad pendel med analytisk
mekanik
CARL CLAUSON
MALTE SLOMA
Contents
1 Abstract 2
2 Sammanfattning 3
3 Introduction 4
3.1 Background . . . . 4
3.2 Purpose . . . . 4
3.3 Problems . . . . 5
3.3.1 Double Pendulum . . . . 5
3.3.2 Kapitza Pendulum . . . . 6
3.3.3 Kapitza Pendulum with elliptic oscillation. . . . . 7
4 Theory 8 4.1 Newtonian Mechanics . . . . 8
4.2 Functionals and Variational Calculus . . . . 8
4.3 Lagrange’s equations . . . . 10
5 Method 11 5.1 Software . . . . 11
5.1.1 Maple with Sophia package . . . . 11
5.1.2 Matlab . . . . 11
5.2 General method . . . . 11
5.3 Double pendulum . . . . 12
5.3.1 Lagrangian mechanics . . . . 12
5.3.2 Solving with Euler-Lagrange equations . . . . 13
5.4 Kapitza pendulum . . . . 14
5.4.1 Lagrangian mechanics . . . . 14
5.4.2 Solving with Euler-Lagrange equations . . . . 14
5.5 Kapitza pendulum with elliptical oscillation . . . . 15
5.5.1 Lagrangian mechanics . . . . 15
5.5.2 Solving with Euler-Lagrange equations . . . . 15
6 Results 16 6.1 Double pendulum . . . . 16
6.2 Kapitza pendulum . . . . 17
6.2.1 Minimum angular velocity to maintain stability . . . . 17
6.2.2 Maximum initial angle to maintain stability . . . . 20
6.3 Kapitza pendulum with elliptical oscillation . . . . 22
6.3.1 Maximum width of the orbit to maintain stability . . . . 22
6.3.2 Influence of width in macro oscillations . . . . 24
A Appendix code 29 A.1 Double pendulum . . . . 29
A.2 Kapitza’s pendulum . . . . 30
A.3 Kapitza’s pendulum with elliptical oscillation . . . . 31
1 Abstract
Analytical mechanics is an alternative to Classical (Newtonian) mechanics for
calculating the movement of particles and systems of particles. In this paper we
analyze three different mechanical systems using analytical mechanics. We then
implement this into the maple based software ”Sophia” to further analyze how
changing some of the parameters alter the behavior of the system. One of our
main focuses in the report is studying the stability of an inverted pendulum. In
1951 the Russian physicist Pyotr Kapitza, figured out that the pendulum could
be stabilized in the upside-down position by forcing it into a rapid vertical oscil-
lation. We examine the boundaries of this stability and explore if the pendulum
can instead be stabilized using an elliptical oscillation.
2 Sammanfattning
Analytisk mekanik ¨ ar ett alternativ till klassisk (Newtonsk) mekanik f¨ or att
ber¨ akna r¨ orelsen av partiklar och system av partiklar. I den h¨ ar rapporten anal-
yserar vi tre olika mekaniska system med analytisk mekanik. Vi implementerar
sedan detta i den maple-baserade programvaran ”Sophia” f¨ or att ytterligare
analysera hur ¨ andringar av vissa parametrar f¨ or¨ andrar systemets beteende. Ett
av v˚ ara huvudsyften med den h¨ ar rapporten ¨ ar att studera stabiliteten hos en
inverterad pendel. ˚ Ar 1951 fann den ryska fysikern Pyotr Kapitza att pendeln
kunde stabiliseras i dess upp-och-ner-l¨ age genom att tvinga den till en snabb
vertikal sv¨ angning. Vi studerar gr¨ anserna f¨ or denna stabilitet och unders¨ oker
om pendeln ist¨ allet kan stabiliseras genom en elliptisk sv¨ angning.
3 Introduction
3.1 Background
Newtonian mechanics has throughout its existence been used to determine vec- tor quantities of forces, momenta and motion in a certain system. When scien- tists discovered that the Newtonian mechanics was not enough to solve certain types of mechanical problems, analytical mechanics was invented which can be defined as a collection of closely related alternative formulations of Newtonian mechanics. Analytical mechanics utilizes scalar properties of motion, i.e usually the systems total potential energy and kinetic energy and not vector quantities of accelerations and forces of individual particles. Lagrangian mechanics is an analytic method which is ideal for calculating the motion of different systems with various types forces, for example pendulums. In the present work we will restrict the forces acting on the system to conservative fields.
A regular pendulum is in it’s ground state stable and will all the time strive to keep the center of mass as low down as possible. In 1951 the Russian physicist Pyotr Kapitza, figured out that the pendulum could be stabilized in the upside- down position by forcing the pendulum into a quick vertical oscillation. This pendulum is one of threee systems that will be studied in this thesis.
3.2 Purpose
The methods of analytical mechanics will be applied to model the three different
physical systems using the dynamic tool for Maple; Sophia [2]. To compute the
motion of these systems using regular Newtonian mechanics is possible but even
with only two degrees of freedom it becomes very complicated. Therefore will
the selected systems firstly be modeled quite easily using analytical mechanics
and then use these methods to solve and analyze three different problems. The
systems are a regular double pendulum, and then two different versions of the
Kapitza pendulum [3].
3.3 Problems
3.3.1 Double Pendulum
Problem 3.29 from Apazidis [3].
Figure 1: Double pendulum.
’Consider a double pendulum consisting of two bars OA and AB of masses m
1and m
2and lengths l
1and l
2respectively that are free to rotate in the vertical plane according to the figure 1. Choose the following numerical values of the parameters m
1= 3 kg, m
2= 1 kg, l
1= l
2= 1 m and calculate and plot the trajectory of end B by means of the Sophia and Graphics packages. Choose the following initial conditions q
1(0) = 1 rad, ˙ q
1(0) = 0 rad, q
2(0) = 1.5 rad,
˙
q2(0) = 0 rad. Calculate then the trajectory of the point B for slightly different
initial conditions and show the sensitive dependence of the motion of the system
on initial conditions by comparing the two trajectories.’
3.3.2 Kapitza Pendulum
Figure 2: Kapitza pendulum.
Consider an inverted pendulum consisting of one bar OA of mass m
1and length l
1that is free to rotate in the vertical plane according to the figure. The bar will be forced into a harmonic vertical oscillation which will stabilize the pendulum.
In order to change the behaviour of the pendulum, parameters will be changed and examined.
The stability of the pendulum will be studied by deciding the minimum angular
velocity ω and the maximum initial angle to maintain stability. The parameters
of the pendulum is described in the method section.
3.3.3 Kapitza Pendulum with elliptic oscillation.
Figure 3: Kapitza pendulum with elliptic oscillation.
Consider an inverted pendulum consisting of one bar OA of mass m
1and length l
1that is free to rotate in the vertical plane according to the figure. The bar will be forced into a harmonic oscillation around an ellipse which will stabilize it vertically. In order to change the behaviour of the pendulum, the parameters will be changed and examined.
The stability of the pendulum will be studied by deciding the maximum re-
lationship between the height and the width of the ellipse in order to maintain
vertical equilibrium. The effect of an increasing width will also be studied,
causing macro oscillations.
4 Theory
4.1 Newtonian Mechanics
From Newton’s laws of motions, the concept of energy can be derived. When describing a conservative mechanical system, energy becomes a key factor to solve the often non-linear differential equations for the system. In classical mechanics the energy of the system can be divided into two parts. The kinetic energy is defined as
T = m(v · v)
2 (4.1)
for a particle with all of it’s mass distributed in one single point. When talking about larger and more complicated structures than particles, e.g a bar, the kinetic energy will consist of two parts, translational and rotational:
T
tot= m(v
G· v
G)
2 + ω
TIω
2 (4.2)
Where the inertia I and the angular velocity ω per definition Apazidis [3].
Potential energy, is defined per the Cambridge Dictionary as the ”energy stored by something because of position (as when an object is raised), because of its condition (as when something is pushed or pulled out of shape), or in chemical form (as in fuel or an electric battery)” [5].
4.2 Functionals and Variational Calculus
A functional is a mathematical operator that uses functions as its input argu- ments and returns a scalar. One fundamental problem of variational calculus is to find a real function y(x) of a real variable x so that the functional of I[y]
becomes an extreme value.
I[y] = Z
x2x1
f y(x), y
0(x), xdx (4.3)
I[y] is the functional of y with fixed endpoints x
1and x
2. The purpose of the functional is to determine those functions y(x), which uses the given values y
1= y(x
1) and y
2= y(x
2) as endpoints and makes the functional I[y] an extremum. In other words, for which functions y(x) the functional I[y] assumes a maximum, minimum or a saddle point. Now assume
I[β] = Z
x2x1
f y(x, β), y
0(x, β), xdx (4.4)
where y(x, β) = y(x) + βη(x) with η(x
1) = η(x
2) = 0. This implies that y(x) is different from y(x, β) but have the same boundary conditions, i.e. multiple paths are possible between the two endpoints.
Figure 4: Example of functions with same boundary conditions.
The variation of I is given by
δI = dI dβ dβ =
Z
x2x1
dx ( ∂f
∂y dy dβ + ∂f
∂y
0dy
0dβ
)
dβ. (4.5)
When the second term in the integral is integrated by parts Z
x2x1
dx ∂f
∂y
0d dx
dy dβ
!
= − Z
x2x1
dx dy dβ
d dx
∂f
∂y
0! + ∂f
∂y
0dy dβ
x2
x1
(4.6)
the conclusion is that the boundary terms do not contribute because dy/dβ = η(x). Therefore
δI = Z
x2x1
dx ( ∂f
∂y − d dx
∂f
∂y
0) dy
dβ dβ. (4.7)
The expression
∂f
∂y − d dx
∂f
∂y
0= δf
δy (4.8)
is called the variational derivative of f by y. δy can be seen as a small variation of the curve y(x) since (dy/dβ)dβ = δy. When δI = 0 i.e. I(β) assumes a extreme value, the integrand in (4.7) can be negligible. This results in
∂f
∂y − d dx
∂f
∂y
0= 0 (4.9)
which is Euler’s differential equation of variational calculus.
4.3 Lagrange’s equations
The Lagrange function is defined as the difference of the systems kinetic and potential energy.
L = T − V (4.10)
As implemented, the Lagrange function is a function of generalized coordinates q
k, their time derivatives ˙ q
kand the time t
L = L(q
k, ˙ q
k, t) (4.11)
where the index k varies depending on the degree of freedom. The action integral S is defined as an integral of the Lagrange function (4.11) along a path in the configuration space between two fixed times t
1and t
2.
S = Z
t2t1
L(q
k, ˙ q
k, t) (4.12)
The action integral (4.12) can be used in Hamilton’s Variational Principle which is a central concept for Langranian mechanics. The principle states that the path of the system between the times t
1and t
2has a extremum along the actual path.
This implies that the action intregal calculated using the actual path is less than for any another possible path, if the extremum is a minimum. Applied to all possible paths, the Hamilton’s Variational Principle can be rewritten using variation calculus from Section 2
δS = δ Z
t2t1