HOME

PDF (letter size)

Finding equations of motion for pendulum on moving cart

Nasser M. Abbasi

January 28, 2024   Compiled on January 28, 2024 at 8:29pm  [public]

Contents

1 Introduction
2 Newton’s Method
2.1 FBD for cart
2.2 FBD for pendulum
3 Lagrange (Energy) method

1 Introduction

This report shows how to determine the equations of motion for a rigid bar pendulum (also called a physical pendulum) on a moving cart as shown in the following diagram. This is done using both Newton’s method and the energy (Lagrangian) method.

It is useful to solve the same problem whenever possible using both methods as this helps verify the results and also adds more understanding to the physics involved.

There are two degrees of freedom. The \(x\) coordinate and the \(\theta \) coordinate. Hence there are two equations of motion, one for each coordinate.

2 Newton’s Method

The first step is to make a free body diagram (FBD). One for the cart and one for the physical pendulum and equate each FBD to the kinematics diagrams in order to write down the equations of motion.

2.1 FBD for cart

Equation of motion along the positive \(x\) direction is\begin {equation} -kx-c\dot {x}+F+P_{x}=M\ddot {x}\tag {1} \end {equation} Equation of motion along positive \(y\) is not needed since cart does not move in the vertical direction.  We see that to find the equation of motion for \(\ddot {x}\) we just need to determine \(P_{x}\), since that is the only unknown in (1). \(P_{x}\) will be found from the physical pendulum equation as is shown below.

2.2 FBD for pendulum

We see now that the equation of motion along the positive \(x\) is\begin {equation} -P_{x}=m\ddot {x}+m\frac {L}{2}\ddot {\theta }\cos \theta -m\frac {L}{2}\dot {\theta }^{2}\sin \theta \tag {2} \end {equation} This gives the \(P_{x}\) term needed. Substituting (2) into (1) gives\begin {align} -kx-c\dot {x}+F-\left ( m\ddot {x}+m\frac {L}{2}\ddot {\theta }\cos \theta -m\frac {L}{2}\dot {\theta }^{2}\sin \theta \right ) & =M\ddot {x}\nonumber \\ -kx-c\dot {x}+F-m\frac {L}{2}\ddot {\theta }\cos \theta +m\frac {L}{2}\dot {\theta }^{2}\sin \theta & =\ddot {x}\left ( M+m\right ) \nonumber \end {align}

Hence\begin {equation} \ddot {x}\left ( M+m\right ) +c\dot {x}+kx+\frac {mL}{2}\left ( \ddot {\theta }\cos \theta -\dot {\theta }^{2}\sin \theta \right ) =F\tag {3} \end {equation} The above is the equation of motion for \(\ddot {x}\).

To find the equation of motion for \(\ddot {\theta }\) we apply \(\tau =I_{cg}\ddot {\theta }\), (equivalent to \(F=ma\) for linear motion) where \(\tau \) is the torque.

When taking moments to find the torque, we should always take moments around the center of mass of the rotating body, even though the pendulum is hinged at one of its ends and it is actually rotating about that hinge ofcourse. If we take moments around the hinge instead of center of mass, then we need to account for the inertia forces due to motion of cart around center of mass of the rigid pendulum which complicates the equations. By taking moments around center of mass, these forces do not account, since their moments is now zero. Using counter clock wise as positive gives

Notice the minus sign on \(-I_{cg}\ddot {\theta }\). This is because we choose the pendulum to be rotating clockwise which is negative. Therefore \(\tau =I_{cg}\ddot {\theta }\) is \begin {align} P_{y}\frac {L}{2}\sin \theta -P_{x}\frac {L}{2}\cos \theta & =-I_{cg}\ddot {\theta }\nonumber \\ P_{y}\frac {L}{2}\sin \theta -P_{x}\frac {L}{2}\cos \theta & =-\frac {1}{12}mL^{2}\ddot {\theta }\tag {4} \end {align}

We already know \(P_{x}\) from Eq. (2). We know need to find \(P_{y}\). This is found from resolving forces in the vertical direction for the pendulum free body diagram. Therefore\begin {align} -P_{y}-mg & =-m\frac {L}{2}\dot {\theta }^{2}\cos \theta -m\frac {L}{2}\ddot {\theta }\sin \theta \nonumber \\ p_{y} & =m\frac {L}{2}\dot {\theta }^{2}\cos \theta +m\frac {L}{2}\ddot {\theta }\sin \theta -mg\tag {5} \end {align}

Plugging (2) and (5) into (4) to eliminate \(P_{x},P_{y}\), then Eq. (4) simplifies to\begin {align*} \left ( m\frac {L}{2}\dot {\theta }^{2}\cos \theta +m\frac {L}{2}\ddot {\theta }\sin \theta -mg\right ) \frac {L}{2}\sin \theta +\left ( m\ddot {x}+m\frac {L}{2}\ddot {\theta }\cos \theta -m\frac {L}{2}\dot {\theta }^{2}\sin \theta \right ) \frac {L}{2}\cos \theta & =-\frac {1}{12}mL^{2}\ddot {\theta }\\ m\frac {L^{2}}{4}\dot {\theta }^{2}\cos \theta \sin \theta +m\frac {L^{2}}{4}\ddot {\theta }\sin ^{2}\theta -mg\frac {L}{2}\sin \theta +m\ddot {x}\frac {L}{2}\cos \theta +m\frac {L^{2}}{4}\ddot {\theta }\cos ^{2}\theta -m\frac {L^{2}}{4}\dot {\theta }^{2}\sin \theta \cos \theta & =-\frac {1}{12}mL^{2}\ddot {\theta }\\ -mg\frac {L}{2}\sin \theta +m\frac {L^{2}}{4}\ddot {\theta }\sin ^{2}\theta +m\ddot {x}\frac {L}{2}\cos \theta +m\frac {L^{2}}{4}\ddot {\theta }\cos ^{2}\theta & =-\frac {1}{12}mL^{2}\ddot {\theta }\\ -mg\frac {L}{2}\sin \theta +m\ddot {x}\frac {L}{2}\cos \theta +m\frac {L^{2}}{4}\ddot {\theta } & =-\frac {1}{12}mL^{2}\ddot {\theta }\\ -g\sin \theta +\ddot {x}\cos \theta & =-\frac {2}{3}L\ddot {\theta } \end {align*}

Therefore\begin {equation} \ddot {\theta }=\frac {3}{2}\left ( \frac {g\sin \theta -\ddot {x}\cos \theta }{L}\right ) \tag {6} \end {equation} The above is the required equation of motion for \(\ddot {\theta }\). Equations (3,6) are coupled and have to be solved numerically since they are nonlinear. Another option is to use small angle approximation to linearize them in order to simplify these two equations and to solve them analytically.

3 Lagrange (Energy) method

The first step in using Lagrange method is to make a velocity diagram to each object. These diagrams are given below

From the velocity diagram above we see that the kinetic energy of the system is\begin {equation} T=\frac {1}{2}M\dot {x}^{2}+\frac {1}{2}mv^{2}+\frac {1}{2}I_{cg}\dot {\theta }^{2}\tag {7} \end {equation} Where \(\frac {1}{2}M\dot {x}^{2}\) is K.E. of the cart due to its linear motion, and \(\frac {1}{2}mv^{2}\) is K.E. of physical pendulum due to its translation linear motion of its center of mass, and \(\frac {1}{2}I_{cg}\dot {\theta }^{2}\) is K.E. of physical pendulum due to its rotational motion. Now the velocity \(v\) of the center of mass of the physical pendulum is determined\begin {align*} v^{2} & =v_{x}^{2}+v_{y}^{2}\\ v_{x}^{2} & =\left ( \dot {x}+\frac {L}{2}\dot {\theta }\cos \theta \right ) ^{2}\\ v_{y}^{2} & =\left ( \frac {L}{2}\dot {\theta }\sin \theta \right ) ^{2} \end {align*}

Therefore the K.E. from (7) becomes\begin {align*} T & =\overset {\text {cart K.E.}}{\overbrace {\frac {1}{2}M\dot {x}^{2}}}+\overset {\text {translation K.E. of physical pendulum}}{\overbrace {\frac {1}{2}m\left ( \left ( \dot {x}+\frac {L}{2}\dot {\theta }\cos \theta \right ) ^{2}+\left ( \frac {L}{2}\dot {\theta }\sin \theta \right ) ^{2}\right ) }}+\overset {\text {rotation K.E.}}{\overbrace {\frac {1}{2}\left ( \frac {1}{12}mL^{2}\right ) \dot {\theta }^{2}}}\\ & =\frac {1}{2}M\dot {x}^{2}+\frac {1}{2}m\left ( \dot {x}^{2}+\frac {L^{2}}{4}\dot {\theta }^{2}\cos ^{2}\theta +\dot {x}L\dot {\theta }\cos \theta +\frac {L^{2}}{4}\dot {\theta }^{2}\sin ^{2}\theta \right ) +\frac {1}{24}mL^{2}\dot {\theta }^{2}\\ & =\frac {1}{2}\dot {x}^{2}(M+m)+\frac {1}{2}m\left ( \frac {L^{2}}{4}\dot {\theta }^{2}+\dot {x}L\dot {\theta }\cos \theta \right ) +\frac {1}{24}mL^{2}\dot {\theta }^{2}\\ & =\frac {1}{2}\dot {x}^{2}(M+m)+m\frac {L^{2}}{8}\dot {\theta }^{2}+\frac {1}{2}m\dot {x}L\dot {\theta }\cos \theta +\frac {1}{24}mL^{2}\dot {\theta }^{2}\\ & =\frac {1}{2}\dot {x}^{2}(M+m)+\frac {1}{2}m\dot {x}L\dot {\theta }\cos \theta +\frac {1}{6}mL^{2}\dot {\theta }^{2} \end {align*}

Taking zero potential energy \(V\) as the horizontal level where the pendulum is attached to the cart, then P.E. comes from only spring extension and the change of vertical position of center of mass of pendulum. Hence P.E. is\[ V=mg\frac {L}{2}\cos \theta +\frac {1}{2}kx^{2}\] The Lagrangian \(\Gamma \) becomes\begin {align*} \Gamma & =T-V\\ & =\overset {T}{\overbrace {\frac {1}{2}\dot {x}^{2}(M+m)+\frac {1}{2}m\dot {x}L\dot {\theta }\cos \theta +\frac {1}{6}mL^{2}\dot {\theta }^{2}}}-\overset {V}{\overbrace {\left ( mg\frac {L}{2}\cos \theta +\frac {1}{2}kx^{2}\right ) }} \end {align*}

There are two degrees of freedom: \(x\) and \(\theta \). The generalized force in \(x\) direction is \(Q_{x}=F-c\dot {x}\) and the generalized force for \(\theta \) is \(Q_{\theta }=0\). Equation of motions are now found. For \(x\) \begin {align*} \frac {d}{dt}\frac {\partial \Gamma }{\partial \dot {x}}-\frac {\partial \Gamma }{\partial x} & =Q_{x}\\ \frac {d}{dt}\left ( \dot {x}(M+m)+\frac {1}{2}mL\dot {\theta }\cos \theta \right ) +kx & =F(t)-c\dot {x}\\ \ddot {x}(M+m)+\frac {1}{2}mL\ddot {\theta }\cos \theta -\frac {1}{2}mL\dot {\theta }^{2}\sin \theta +kx & =F(t)-c\dot {x}\\ \ddot {x}(M+m)+c\dot {x}+kx+\frac {1}{2}mL\ddot {\theta }\cos \theta -\frac {1}{2}mL\dot {\theta }^{2}\sin \theta & =F(t) \end {align*}

Therefore\[ \ddot {x}(M+m)+c\dot {x}+kx+\frac {mL}{2}\left ( \ddot {\theta }\cos \theta -\dot {\theta }^{2}\sin \theta \right ) =F(t) \] Which is the same result as Newton method found above in Eq. (3). Equation of motion for \(\theta \) is \[ \frac {d}{dt}\frac {\partial \Gamma }{\partial \dot {\theta }}-\frac {\partial \Gamma }{\partial \theta }=0 \] But\begin {align*} \frac {\partial \Gamma }{\partial \dot {\theta }} & =\frac {1}{2}m\dot {x}L\cos \theta +\frac {1}{3}mL^{2}\dot {\theta }\\ \frac {\partial \Gamma }{\partial \theta } & =-\frac {1}{2}m\dot {x}L\dot {\theta }\sin \theta +mg\frac {L}{2}\sin \theta \end {align*}

Hence  \(\frac {d}{dt}\frac {\partial \Gamma }{\partial \dot {\theta }}-\frac {\partial \Gamma }{\partial \theta }=0\) becomes\begin {align*} \frac {d}{dt}\left ( \frac {1}{2}m\dot {x}L\cos \theta +\frac {1}{3}mL^{2}\dot {\theta }\right ) -\left ( -\frac {1}{2}m\dot {x}L\dot {\theta }\sin \theta +mg\frac {L}{2}\sin \theta \right ) & =0\\ \frac {d}{dt}\left ( \frac {1}{2}m\dot {x}L\cos \theta +\frac {1}{3}mL^{2}\dot {\theta }\right ) +\frac {1}{2}m\dot {x}L\dot {\theta }\cos \theta -mg\frac {L}{2}\sin \theta & =0\\ \frac {1}{2}mL\ddot {x}\cos \theta -\frac {1}{2}mL\dot {x}\dot {\theta }\sin \theta +\frac {1}{3}\ddot {\theta }mL^{2}+\frac {1}{2}m\dot {x}L\dot {\theta }\cos \theta -mg\frac {L}{2}\sin \theta & =0\\ \frac {1}{2}mL\ddot {x}\sin \theta +\frac {1}{3}\ddot {\theta }mL^{2}-mg\frac {L}{2}\sin \theta & =0\\ \ddot {x}\sin \theta +\frac {2}{3}\ddot {\theta }L-g\sin \theta & =0 \end {align*}

Therefore\[ \ddot {\theta }=\frac {3}{2}\left ( \frac {g\sin \theta -\ddot {x}\sin \theta }{L}\right ) \] Which is the same equation of motion in Eq. (6) above given by Newton’s method.