HOME
PDF (letter size)
PDF (legal size)

## Finding equations of motion for pendulum on moving cart

November 5, 2018   Compiled on November 5, 2018 at 9:08am  [public]

### 1 Introduction

This report shows how to determine the equations of motion for a rigid bar pendulum (physical pendulum) on a moving cart as shown in the following diagram using both Newton’s method and the energy (Lagrangian) method. It is useful to solve the same problem when possible using both methods as this will help verify the results. Figure 1: Pendulum on moving cart

There are two degrees of freedom. The $$x$$ coordinate and the $$\theta$$ coordinate. Hence we need to ﬁnd two equations of motion, one for each coordinate.

### 2 Newton’s Method

The ﬁrst step is to make 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 Figure 2: Pendulum on moving cart

Equation of motion along positive $$x$$ 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 vertical direction.  We see that to ﬁnd equation 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 Figure 3: Pendulum on moving cart

We see now that the equation of motion along 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 us the $$P_{x}$$ we wanted to plug in (1). Equation (1) now becomes\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} \fbox{$\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 equation of motion for $$\ddot{x}$$.

To ﬁnd equation of motion for $$\ddot{\theta }$$ we take moments around C.G. of the rigid pendulum, using counter clock wise as positive. This gives\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 know $$P_{x}$$ from (2). We know need to just ﬁnd $$P_{y}$$. This is found from resolving forces in the vertical direction for the pendulum free body diagram giving\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 (4) simpliﬁes 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} \fbox{$\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 or small angle approximation can be used in order to simplify these two equations and to solve them analytically.

### 3 Lagrange method

The ﬁrst step in using Lagrange method is to make a velocity diagram to each object. This is shown below Figure 4: Pendulum on moving cart

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 cart due to its linear motion, and $$\frac{1}{2}mv^{2}$$ is K.E. of physical pendulum due to its translation 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 we ﬁnd $$v$$\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 attach to the cart, then P.E. comes from only spring extension and change of vertical position of center of mass of pendulum which is given by $V=mg\frac{L}{2}\cos \theta +\frac{1}{2}kx^{2}$ Hence the Lagrangian $$\Gamma$$ is \begin{align*} \Gamma & =T-V\\ & =\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}-mg\frac{L}{2}\cos \theta -\frac{1}{2}kx^{2} \end{align*}

There are two degrees of freedom: $$x$$ and $$\theta$$. The generalized forces in for $$x$$ are given by $$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$\fbox{\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 (3). Now we ﬁnd equation of motion for $$\theta$$ $\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$\fbox{\ddot{\theta }=\frac{3}{2}\left ( \frac{g\sin \theta -\ddot{x}\sin \theta }{L}\right ) }$ Which is the same ODE (6) above given by Newton’s method.