Pendulum-Cart System: Analysis of The Equations of Motions

You might also like

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

Pendulum-Cart System

Analysis of the equations of motions

Denis Kartachov

Professor Ivan Ivanov


201-HTL-VA Differential Equations

May 22, 2016


Abstract
The pendulum-cart system is interesting because it involves the motions of two bodies
and shows how they interact with each other. That is, the cart’s motion affects the
pendulum and vice-versa. Because of its complexity, a thorough study of such a system
would be a worthwhile pursuit. This paper dealt with the equations of motion of such a
system in the most straight-forward manner; they were directly derived from free-body-
diagram analyses of both components. These equations of motions were solved
numerically in Matlab because of their non-linear nature. Using Matlab allowed for the
analysis of a few compelling cases through the input of various initial conditions. Graphs
for the positions and velocities of both structures were included for all cases to give an
overview of the system in motion.

2
Table of Contents

The pendulum-cart system.................................................................................................................... 4


Free-body-diagram of the pendulum ............................................................................................... 5
Free-body-diagram of the cart ......................................................................................................... 7
Equations of motion .............................................................................................................................. 8
Uncoupling the equations of motion ............................................................................................. 10
State-space representation ............................................................................................................ 11
Equations of motion in Matlab ....................................................................................................... 12
Analysis of some cases ........................................................................................................................ 14
Case 1: Cart at rest, pendulum in motion ...................................................................................... 14
Case 2: Cart & pendulum in motion, low friction .......................................................................... 16
Case 3: Cart & pendulum in motion, considerable friction ........................................................... 21
Case 4: Cart & pendulum in motion, high friction ......................................................................... 23
Discussing phase differences............................................................................................................... 25

3
The pendulum-cart system
The pendulum-spring-mass system consists of two oscillating systems. The cart
is attached to a spring which is itself attached to a wall. The cart is then pulled from its
equilibrium position and engages in oscillatory motion. In addition there is a pendulum
hanging below the cart, which can also be given initial conditions by pulling it at some
angle to the vertical. The motion of the cart causes the pendulum to oscillate as well. In
the following diagram, the cart moves to the left with the pendulum following because of
the cart’s inertia:

Figure 1: The pendulum-mass-spring system

In figure 1, a pendulum of mass and length is attached to a cart of mass which is


constrained to move in one direction. The pendulum, however, is free to move in the
horizontal and vertical directions. At some instant in time, the cart will have moved a
distance from the equilibrium, and the pendulum will have an amplitude of . The forces
acting on the system can be analyzed using Newton’s second law of motion.

4
Free-body-diagram of the pendulum

Figure 2: FBD for the pendulum

Figure 2 shows all the forces acting on the pendulum of mass . The tension in the rope
attached to the mass prevents it from flying away, and is given by . The gravitational
force, , acts vertically downward and affects the motion of the pendulum. The other
force is the frictional force . To find this force, one can assume that the torque friction is
proportional to the angular velocity of the pendulum, that is:

To find the friction force, one can express the left hand side term for torque as follows:

5
Hence the friction force is itself proportional to the angular velocity, with a constant of
proportionality given by , where is the coefficient of friction and is the length of the
pendulum. Before analyzing the forces acting on the pendulum, it is essential to derive
the position, velocity and acceleration of the pendulum. To do this, one can make the
following observations:
= +
=−

Where , are the horizontal and vertical positions of the pendulum, and is the
displacement of the cart from its equilibrium position. Differentiating these equations once
gives the velocity of the pendulum:

= +
= ′

Differentiating a second time yields the acceleration of the pendulum:

= + ( −( ) )
= ( +( ) )

Now it is possible to analyze the forces acting on the pendulum using Newton’s second
law:

− cos − sin =

− cos − sin = [ + cos − ( ) sin ] (1)

6
=

cos − sin − = ′′

cos − sin − = [ sin + ( ) cos ] (2)

Equations (1) and (2) are the equations of motions for the pendulum. Next, the equations
of motion for the cart will have to be derived.

Free-body-diagram of the cart

3: FBD for the cart


Figure 4:
5:

The diagram above shows all the forces acting on the cart. The cart is being displaced
to the left by . The frictional force opposes this motion, and is assumed to be proportional
to the velocity of the cart, i.e.: , where is the coefficient of friction. Similarly, the
restoring force of the spring opposes the motion of the cart and is given by , where

7
is the spring constant. The tension from the pendulum’s rope as acts on the cart, given
by . Another important force to consider is the frictional force from the pendulum itself.
Just like the force of tension, Newton’s third law says that the frictional force acting on the
pendulum also acts on the cart, in the opposite direction. The other forces include the
gravitational force , which is countered by the normal force exerted by the surface
underneath, . Using Newton’s second law, the forces can be split into their horizontal
and vertical components as follows:

cos + sin − − = (3)

=0

+ sin − − cos =0

The only equation of motion that will be needed for the cart is equation (3), because the
cart does not accelerate in the vertical direction.

Equations of motion
So far, the following three equations of motions have been derived:

⎧− cos − sin = [ + cos − ( ) sin ]



cos − sin − = [ sin + ( ) cos ] (4)

⎪ cos + sin − − =

All the constants in the equations (4) are given except for the tension, . It would be
much simpler to work with two equations by eliminating the tension variable from the mix.
A new equation of motion can be derived by adding equations I and II of (4) as follows:

8
− − = [ + cos − ( ) sin ] +
− − =( + ) + cos − sin
( + ) + + = sin − cos (5)

To find a second equation of motion similar to (5), equation I of (4) can be multiplied by
cos and equation II of (4) can be multiplied by sin to obtain the following equations:

− sin cos − cos = cos + cos − sin cos

sin cos − sin − sin = sin + sin cos

These two equations can be added together to yield the following equation of motion:

− (sin + cos )− sin = (sin + cos )+ cos

cos + =− − sin (6)

Now there are only two equations of motion which contain only known variables. The
following system of differential equations (5) and (6) can now be solved:

( + ) + + = sin − cos
(7)
cos + =− − sin

Upon quick inspection, the equations of motion (7) are non-linear because of the
cosine/sine terms as well as the angular velocity term squared. A numerical approach
must be utilized to solve this system of differential equations.

9
Uncoupling the equations of motion
Before proceeding with the solutions, the equations of motion in (7) must be written as a
system of four first order differential equations. First, the equations of motion must be
uncoupled, that is, they must be rewritten such that they contain only one second order
derivative. One equation can be derived by multiplying the second equation of (7) by
cos and adding the two equations, as follows:

( + ) + + − cos − sin cos = sin + cos

( + ) − cos = sin + sin cos + cos − −

sin + sin cos + cos − −


= (8)
+ sin

Similarly, to find a second uncoupled equation of motion, the first equation of (7) can be
multiplied by cos , and the second equation can be multiplied by −( + ). These
two equations can then be added to obtain:

cos + cos − ( + )

= sin cos − cos +( + ) +( + ) sin

cos −( + ) = sin cos + ( + )( + sin )

− cos ( + )

sin cos + ( + )( + sin ) − cos ( + )


=
cos − −

− sin cos − 1 + −( + ) sin + cos ( + )


= (9)
( + sin )

10
Therefore the new uncoupled equations of motion are (8) and (9):

⎧ sin + sin cos + cos − −


⎪ =
+ sin
(10)
⎨ − sin cos − 1 + −( + ) sin + cos ( + )
⎪ ′′ =
⎩ ( + sin )

State-space representation
To numerically solve the equations of motion, the system of second order differential
equations (10) must be expressed as a system of first order differential equations.
Because there are two equations in (10), one can expect four first order differential
equations. The following change of variables can be made:

=
=
=
=

This change of variables transforms the system of equations (10) into a system of four
first order differential equations:

=

=

⎪ sin + sin cos + cos − −
=
+ sin (11)
(11)


⎪ − sin cos − 1+ −( + ) sin + cos ( + )
⎪ =
⎩ ( + sin )

This is the state-space form of the equations of motions that can be used to find numerical
solutions. Some constants will be substituted by the following values:

11
=5
⎧ = 0.05

= 25
⎨ = 9.8

⎩ = 0.25

The values for the coefficients of friction , are not determined as of now because they
will be constantly changed to study different cases. Substituting the values for the
constants above as well as changing the variables for more intuitive ones yields the
following state-space representation of the equations of motion:

′=
⎧ ′=
⎪ 1
⎪ sin + 0.49 sin cos + 4 cos − − 25
′= 80 (12)
⎨ 5 + 0.05 sin
⎪ 1
⎪ − 80 sin cos − 404 − 49.49 sin + cos ( + 25 )
⎩ ′= 1.25 + 0.0125 sin

Here, is the velocity of the cart and is the angular velocity of the pendulum.

Equations of motion in Matlab


A function command can be set-up for the equations of motions. In Matlab, the column
vector of derivatives is given by:
(1,1) = =

(2,1) = =
⎨ (3,1) = =
⎩ (4,1) = =

Hence the variables in (12) are expressed as:

(1) =

(2) =
⎨ (3) =
⎩ (4) =

12
The following figure shows the Matlab function for the equations of motion (12).

Figure 6: Matlab equations of motion function

The following script can be used to input initial conditions for the equations of motion:

13

Figure 7: Script used for solving the equations of motion


The ‘function solver’ in figure 7 will plot a figure showing the positions of the cart and the
pendulum, and a separate figure showing the velocities. Different cases can now be
studied by specifying initial conditions 0(1,1), 0(2,1), 0(3,1), 0(4,1) and inputting
values for , which are the coefficients of friction for the pendulum and the cart
respectively.

Analysis of some cases


Case 1: Cart at rest, pendulum in motion
The first case studied would be when the cart is experiencing very high friction. On the
other hand, the pendulum will practically be moving in a frictionless environment. The
predictions are the following: the cart would barely move, if not at all. However, one would
expect the pendulum to undergo damped simple harmonic motion. The following initial
values will be specified:
0(1,1) = (0) = 0

⎪ 0(2,1) = (0) =
6
⎨ 0(3,1) = (0) = 0

⎩ 0(4,1) = (0) = 0

The values for the coefficients of friction will be assumed to be:

= =1
= = 0.001

The value for the coefficient of friction of the cart in this case is relatively high, and the
coefficient of friction for the pendulum is rather low. Inputting these initial values as well
as the coefficients of friction into the Matlab program results in the following graphs:

14
Figure 8: Position graphs for cart and pendulum

15
Figure 9: Velocity graphs for cart and pendulum
As expected, the cart barely experiences any motion. Its position remains almost
fixed at the equilibrium point = 0, and its velocity is almost zero as well. The position
and motion of the cart are not exactly constant, as there are very slight oscillations seen
in figures 8 and 9. Overall, however, the motion of the cart can be ignored. It’s important
to point out that the coefficient of friction for the cart did not influence its motion. This is
mainly due to the initial conditions. It was assumed that the cart started at the equilibrium
point with no initial velocity. Because the pendulum’s mass is small compared to the
cart’s mass, and because of the spring’s stiffness, the cart does not exhibit noticeable
motion.
The pendulum, on the other hand, experiences clear damped simple harmonic
motion. In figure 8, the pendulum’s amplitude decreases exponentially as a function of
time. This decrease is influenced by the pendulum’s coefficient of friction. Similarly in
figure 9, the pendulum’s maximum velocity also decreases exponentially. This first case
was trivial and showed intuitive results. It is also possible for the pendulum to remain
relatively stationary with the cart experiencing simple harmonic motion. The results are
very similar, so they will not be included. More interesting cases arise when the cart is
given an initial displacement.

Case 2: Cart & pendulum in motion, low friction


A particularly interesting case arises when one gives initial displacements and velocities
for both the cart and the pendulum. The following initial conditions will be assigned:

0(1,1) = (0) = 0.1



⎪ 0(2,1) = (0) =
6
⎨ 0(3,1) = (0) = 0.1 ⁄

(0) =
⎩ 0(4,1) = 20

It will also be assumed that the coefficients of friction are relatively low to allow the cart
and the pendulum to experience oscillatory motion:

16
= = 0.1
= = 0.001

Inputting these initial conditions and values for coefficients of friction in the Matlab function
solver script gives the following graphs:

Figure 10: Position graphs for cart and pendulum

17
Figure 11: Velocity graphs for cart and pendulum

This case is very interesting because both the cart and pendulum experience oscillatory
motion. Considering first figure 10, one can make the observation that the cart’s
amplitude of oscillation is constant. This makes quite some sense because the mass of
the cart is much larger than the mass of the pendulum, and its motion shouldn’t really be
affected by the pendulum. On the other hand, the pendulum’s position is heavily
influenced by the cart’s motion. As seen in figure 10, the pendulum tries to keep up with
the cart’s oscillation and results in weird patterns.
Similarly in figure 11, the cart’s motion is unaffected by the pendulum; the
amplitude of its velocity is constant, for the same reasons explained above. The
pendulum’s motion is also affected by the cart’s motion. One can also notice that in both
figures, the pendulum’s amplitude seems to converge toward the cart’s amplitude. This

18
can’t clearly be seen because of the short 10 second timespan. The timespan can be
increased to reveal the graphs’ intricacies:

Figure 12: Position graph for cart and pendulum (larger timespan)

19
Figure 13: Velocity graphs for cart and pendulum (increased timespan)

As expected, the amplitude oscillation for the pendulum in figures 12 and 13 converges
toward the cart’s amplitude before dropping even lower and remaining constant.
Obviously, the pendulum and cart start out by oscillating out of phase as seen in figures
10 and 11. However, given enough time, the cart and pendulum will eventually oscillate
in phase as figures 12 and 13 clearly show. As it turns out, the initial conditions do not
affect the change in phase difference over time. In fact, the spring constant has an effect
on the phase difference between both oscillations. This will be discussed in a separate
section.

20
Case 3: Cart & pendulum in motion, considerable friction
Another case of interest to be considered is when the cart and pendulum are both affected
by friction, although they are still capable of oscillatory motion. Similarly as in case 2,
both the pendulum and the cart will be given initial conditions, as follows:

0(1,1) = (0) = 0.3



⎪ 0(2,1) = (0) =
4
⎨ 0(3,1) = (0) = 0

⎩ 0(4,1) = (0) = 0

As this case suggests, the coefficients of friction will be high enough to damp the
oscillatory motions of the pendulum and the cart. The following values are assigned:

= =1
= = 0.1

Inputting these initial conditions along with the coefficients of friction into the Matlab
function solver gives the following graphs for the position and velocity of both the
pendulum and the cart:

21
Figure 14: Position graphs for cart and pendulum

22

Figure 15: Velocity graphs for cart and pendulum


Both figures 14 and 15 clearly show that the cart and the pendulum experience damped
oscillatory motion. As mentioned previously, the cart experiences smooth exponential
decay unaffected by the pendulum’s motion. The pendulum, however, is largely affected
by the cart’s motion. This is especially seen in the first seconds of figures 14 and 15. The
pendulum experiences weird motion in the beginning before settling down to continue its
exponential decay with the pendulum. From deduction, given enough time both the cart
and the pendulum will stop completely.

Case 4: Cart & pendulum in motion, high friction


Another extreme case arises when the friction is very high. In this case, the cart and the
pendulum will not experience any oscillatory motion. Instead, they will slowly decay to
their equilibrium positions. The following initial conditions are specified:

0(1,1) = (0) = 0.2



⎪ 0(2,1) = (0) =
10
⎨ 0(3,1) = (0) = 0

⎩ 0(4,1) = (0) = 0

For this case, the frictions will have to be relatively high to damp the system:

= = 10
= = 0.9

Under these conditions, the Matlab function solver script reveals the following graphs

23
Figure 16: Position graphs for cart and pendulum

24

Figure 17: Velocity graphs for cart and pendulum


As expected, the cart and pendulum will not experience oscillatory motion under high
friction. In figure 16, the pendulum’s position slowly decays toward its equilibrium point.
Meanwhile, the cart is able to achieve a small oscillation in the beginning before settling
toward its equilibrium position very rapidly. In figure 17, the cart will achieve its highest
velocity at the equilibrium position before rapidly decaying toward zero velocity, as
expected. Under high friction, the pendulum’s motion does not seem to be affected by
the cart.

Discussing phase differences

As mentioned previously, the phase difference seems to depend on the spring constant.
For a given set of masses, it is possible to alter the spring constant to achieve different
phase oscillations. After experimenting with different values in Matlab, it turns out that
increasing the spring constant up to a specific value will make both components oscillate
in-phase. For demonstration purposes, the following masses will be assigned for the cart
( ) and pendulum ( ):
=2
=1

By fixing these values and altering the value for the spring constant, it is possible to obtain
oscillations in phase and out of phase. Although the conditions for these combinations
aren’t explained in this paper, the results seem promising. The coefficients of friction in
this section are 0.1 for the cart and 0.001 for the pendulum. The initial conditions are the
same as in case 1. For example, consider the following position graphs for the cart and
pendulum with different values for the spring constant :

25
Figure 18: k=25N/m

Figure 19: k=50N/m

26
Figure 20: k=100N/m

The lowest value for the spring constant shows the position of the cart and pendulum as
seen in figure 18. The phase difference seems pretty random; same goes for the higher
spring constant seen in figure 19. Actually, it also looks like they are in phase at some
points and out of phase in others. However, when the spring constant reaches a
numerical value of 100 it seems like the components oscillate in phase right from the
beginning. When the spring constant exceeds this value, the position graphs are similar
to the ones in figures 18 and 19. Obviously, there seems to be a sweet spot for the spring
constant which makes the components oscillate completely in phase. Apart from trial and
error, it is unlikely that there is an explicit way to calculate this value. In fact, there may
be other such values. Keep in mind that the length of the pendulum was held constant at
0.25 in all three trials. For such an oscillation to occur, the length of the pendulum has
to remain pretty small.

On the other hand, decreasing the spring constant tends to yield an out of phase
oscillation. For instance, the following graphs show the positions of the cart and
pendulum for very small values of :

27
Figure 21: k=5N/m

28
Figure 22: k=5N/m
As seen in figures 21 and 22, decreasing the spring constant makes the components
oscillate out of phase. Obviously, with such a low spring constant, the cart’s motion will
be heavily affected by the pendulum. There are most likely other combinations which can
give similar results, but the spring constant definitely seems to affect the phase difference
between both oscillations.

29
References
http://www.myphysicslab.com/pendulum_cart.html
http://www.mathworks.com/matlabcentral/

30

You might also like