Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ECE 680

Selected Notes from Lecture 3

January 14, 2008

Using the Lagrangian to obtain Equations of Motion


In Section 1.5 of the textbook, Zak introduces the Lagrangian L = K U , which is the
difference between the kinetic and potential energy of the system. He then proceeds to
obtain the Lagrange equations of motion in Cartesian coordinates for a point mass subject
to conservative forces, namely,
d
dt

L
x i

L
= 0 i = 1, 2, 3.
xi

(1)

(Any nonconservative forces acting on the point mass would show up on the right hand
side.)
Heres how the text gets from the definition to the result.
We know that for a point mass, force is equal to mass times acceleration,
F = ma = m
x=m

dx
,
dt

and work is equal to the integral over distance of the applied force. We can substitute for
the force to obtain
W =
=
=

Z B
A
Z B
A
Z B

F dx

(2)

m
x dx

(3)

mx dx

(4)

where we have played fast and loose with the derivatives to conclude that
xdx = (dx/dt)dx

= dx(dx/dt)

= xd
x.

Assuming conservative forces, we can then integrate to obtain


W =

m  T  B
x x
A
2

(5)

so the work is the difference between the kinetic energy at point B and that at point A.
Conservation of energy requires that an increase in kinetic energy must be balanced by
decrease in potential energy so we can write

Z B

F dx = U

and thus
F = U,

(6)

ECE 680

Selected Notes from Lecture 3

where we use the notation


"

U U U
U :=
x1 x2 x3

January 14, 2008

#T

We have used the fact that if we measure change in potential energy with respect to a
constant reference, the derivative of the constant reference is zero so we have
(U ) = U.
Were almost ready to rewrite Newtons equation in its Lagrangian form.
We know that

K
= mx i
x i

(7)

so Newtons law becomes


d
F = (U )i =
dt

K
x i

= m
xi

i = 1, 2, 3.

(8)

Now with L = K U , we see that K does not depend on position and U does not depend
on velocity, so
K
L
=
x i
x i
L
U
=
xi
xi

(9)
(10)

so Newtons equation can be rewritten as


d
dt

L
x i

L
= 0 i = 1, 2, 3
xi

(11)

as asserted earlier.
Next, in Section 1.6, Zak extends the above analysis to generalized coordinates by expressing each of the xi in terms of new coordinates qi . By the chain rule we then have
x i =

xi
xi
xi
q1 +
q2 +
q3
q1
q2
q3

(12)

and after repeating the derivation with the new coordinates qi we obtain, (surprise, surprise,)
!
d L
L

= 0 i = 1, 2, 3.
(13)
dt qi
qi
If the applied force has a nonconservative component, the right-hand side is equal to the
nonconservative component rather than zero.
Lets do a couple of simple examples to demonstrate that this is a viable method for
obtaining the equations of motion.

ECE 680

Selected Notes from Lecture 3

January 14, 2008

Example 1: Pendulum
Consider a pendulum of mass m and length ` with angular displacement from the
vertical. From the geometry, the expressions for the kinetic and potential energies are
1  2
m l
2
U = mgl (1 cos ) .

K =

(14)
(15)

Accordingly,
1
L = K U = m`2 2 mgl(1 cos ).
2

(16)

L
= mg` sin

(17)

L
= m`2

(18)

The

and
so
d
dt

= m`2

(19)

and finally solving for we have


g sin
.
=
`

(20)

Example 2: Pendulum on Cart


This may have seemed like a very difficult way to get the equation of motion of a pendulum,
so lets try a more complicated example. We hang the pendulum from a cart of mass M
and position x, acted upon by a force u in the direction of x, and moving on frictionless
rails.
The the x position of the pendulum is x+` sin and the y position is ` cos , so the kinetic
energy is
!2
!2
1
d
1
d
1
2
(x + ` sin ) + m
(` cos ) .
(21)
K = M x + m
2
2
dt
2
dt
First taking the time-derivatives, then squaring, then noting that cos2 + sin2 = 1 we
obtain
1
1
(22)
K = (M + m) x 2 + m`x cos + m`2 2 .
2
2
The potential energy is as before, so
L=K U =

1
1
(M + m) x 2 + m`x cos + m`2 2 mg` (1 cos ) .
2
2

(23)

ECE 680

Selected Notes from Lecture 3

January 14, 2008

Clearly L/x = 0 and


L
= (M + m) x + m` cos
x
so
d
dt

L
x

(24)


= (M + m) x + m` cos 2 sin = u

(25)

Next we consider the direction and velocity, taking


L
= m`x sin + mg` sin

(26)

and

= m`x cos + m`2 .

Taking the time derivative yields


d
dt

(27)

= m`
x cos m`x sin + m`2 .

(28)

The Lagrangian equation of motion is thus




m` x cos + ` g sin = 0.

(29)

We can write this as a matrix differential equation


"

M + m m` cos
cos
`

#"

"

m`2 sin + u
g sin

(30)

Of course the cart pendulum is really a fourth order system so well want to define a new
iT
h
state vector x x in order to solve the nonlinear state equation.
(31)
For comparison, it will be instructive to read Section 1.7 in which Zak presents an example
of a cart with inverted pendulum. Instead of using the Lagrangian equations of motion,
he applies Newtons law in its usual form. There are a couple of differences between the
examples. Specifically, in the example in Section 1.7
1. the pendulum is a distributed rather than point mass, and
2. frictional force on the cart wheels is considered.

You might also like