solve the first practice problems using Lagrangian approach.
Only the velocity diagram is needed for the Lagrangian method. The generalized coordinates are: \(x,\theta \)
Let \(L\) be the Lagrangian, and let \(T\) be the kinetic energy of the system, and \(V\) the potential energy.\[ L=T-V \]\[ T=\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}mv^{2}\] Where \(v\) is the speed of the mass \(m\) which is
Hence\begin{align*} T & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \left ( \dot{x}+L\dot{\theta }\cos \theta \right ) ^{2}+\left ( L\dot{\theta }\sin \theta \right ) ^{2}\right ) \\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+\left ( L\dot{\theta }\right ) ^{2}+2\dot{x}L\dot{\theta }\cos \theta \right ) \end{align*}
For the potential energy\[ V=\frac{1}{2}kx^{2}+mgL\cos \theta \] Therefore, \(L\) becomes\begin{align*} L & =T-V\\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+\left ( L\dot{\theta }\right ) ^{2}+2\dot{x}L\dot{\theta }\cos \theta \right ) -\left ( \frac{1}{2}kx^{2}+mgL\cos \theta \right ) \end{align*}
To obtain equations of motion, we evaluate \[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{x}}\right ) -\frac{\partial L}{\partial x}=Q_{x}\]
and\[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{\theta }}\right ) -\frac{\partial L}{\partial \theta }=Q_{\theta }\]
For the generalized forces, we can readily see that \(Q_{x}=F\) and \(Q_{\theta }=0\). Hence for \(x\) we write
\[ \frac{\partial L}{\partial \dot{x}}=M\dot{x}+m\dot{x}+mL\dot{\theta }\cos \theta \]
\[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{x}}\right ) =M\ddot{x}+m\ddot{x}+mL\ddot{\theta }\cos \theta -mL\dot{\theta }^{2}\sin \theta \]
\[ \frac{\partial L}{\partial x}=-kx \] Hence, for the mass \(M\), the equation of motion is
Substitute Eq. (2) into Eq. (1) gives\begin{align} x^{\prime \prime } & =\frac{F\left ( t\right ) -kx-mL\left [ \frac{g\sin \theta -x^{\prime \prime }\cos \theta }{L}\right ] \cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{M+m}\nonumber \\ & =\frac{F\left ( t\right ) -kx-mg\sin \theta \cos \theta +mx^{\prime \prime }\cos ^{2}\theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{M+m}\nonumber \\ x^{\prime \prime }\left ( M+m\right ) -mx^{\prime \prime }\cos ^{2}\theta & =F\left ( t\right ) -kx-mg\sin \theta \cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \nonumber \\ x^{\prime \prime } & =\frac{F\left ( t\right ) -kx-mg\sin \theta \cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{\left ( M+m-m\cos ^{2}\theta \right ) }\tag{3} \end{align}
Also, we can solve for \(\theta ^{\prime \prime }\) by Substituting Eq. (1) into (2)\begin{align} \theta ^{\prime \prime } & =\frac{g\sin \theta -\left ( \frac{F\left ( t\right ) -kx-mL\theta ^{\prime \prime }\cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{M+m}\right ) \cos \theta }{L}\nonumber \\ L\theta ^{\prime \prime }\left ( M+m\right ) & =g\sin \theta \left ( M+m\right ) -\left ( F\left ( t\right ) -kx-mL\theta ^{\prime \prime }\cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \right ) \cos \theta \nonumber \\ L\theta ^{\prime \prime }\left ( M+m\right ) & =g\sin \theta \left ( M+m\right ) -F\left ( t\right ) \cos \theta +kx\cos \theta +mL\theta ^{\prime \prime }\cos ^{2}\theta -mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \cos \theta \nonumber \\ L\theta ^{\prime \prime }\left ( M+m\right ) -mL\theta ^{\prime \prime }\cos ^{2}\theta & =g\sin \theta \left ( M+m\right ) -F\left ( t\right ) \cos \theta +kx\cos \theta -mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \cos \theta \nonumber \\ \theta ^{\prime \prime } & =\frac{g\sin \theta \left ( M+m\right ) -F\left ( t\right ) \cos \theta +kx\cos \theta -mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \cos \theta }{L\left ( M+m-m\cos ^{2}\theta \right ) }\tag{4} \end{align}
Eqs. (3) and (4) is what we will use to convert the system to first order form since they are in decoupled form.
Using the decoupled ODE’s above, Eqs (3) and (4), and introducing 4 state variables \(x_{1},x_{2},x_{3}\,x_{4}\) we obtain\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\end{pmatrix} & =\begin{pmatrix} x\\ \theta \\ x^{\prime }\\ \theta ^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} =\begin{pmatrix} x^{\prime }\\ \theta ^{\prime }\\ x^{\prime \prime }\\ \theta ^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{F\left ( t\right ) -kx-mg\sin \theta \cos \theta +mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{\left ( M+m-m\cos ^{2}\theta \right ) }\\ \frac{g\sin \theta \left ( M+m\right ) -F\left ( t\right ) \cos \theta +kx\cos \theta -mL\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \cos \theta }{L\left ( M+m-m\cos ^{2}\theta \right ) }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{F\left ( t\right ) -kx_{1}-mg\sin x_{2}\cos x_{2}+mLx_{4}^{2}\sin x_{1}}{\left ( M+m-m\cos ^{2}x_{2}\right ) }\\ \frac{g\sin x_{2}\left ( M+m\right ) -F\left ( t\right ) \cos x_{2}+kx_{1}\cos x_{2}-mLx_{4}^{2}\sin x_{2}\cos x_{2}}{L\left ( M+m-m\cos ^{2}x_{2}\right ) }\end{pmatrix} \end{align*}
Only the velocity diagram is needed for the Lagrangian method. The generalized coordinates are: \(x,\theta \)
Let \(L\) be the Lagrangian, and let \(T\) be the kinetic energy of the system, and \(V\) the potential energy.\[ L=T-V \]\[ T=\frac{1}{2}M\dot{x}^{2}+\overset{\text{angular bar K.E.}}{\overbrace{\frac{1}{2}I_{g}\dot{\theta }^{2}}}+\overset{\text{linear\ bar\ K.E. of its c.g.}}{\overbrace{\frac{1}{2}m\left ( \dot{x}^{2}+\left ( a\dot{\theta }\right ) ^{2}+2\dot{x}a\dot{\theta }\cos \theta \right ) }}\] And\[ V=\frac{1}{2}kx^{2}+mga\cos \theta \] Therefore, \(L\) becomes\begin{align*} L & =T-V\\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}I_{g}\dot{\theta }^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+\left ( a\dot{\theta }\right ) ^{2}+2\dot{x}a\dot{\theta }\cos \theta \right ) -\left ( \frac{1}{2}kx^{2}+mga\cos \theta \right ) \end{align*}
To obtain equations of motion, we evaluate \[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{x}}\right ) -\frac{\partial L}{\partial x}=F \] and\[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{\theta }}\right ) -\frac{\partial L}{\partial \theta }=0 \] For \(M\) we obtain\[ \frac{\partial L}{\partial \dot{x}}=M\dot{x}+m\dot{x}+ma\dot{\theta }\cos \theta \]\[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{x}}\right ) =M\ddot{x}+m\ddot{x}+ma\ddot{\theta }\cos \theta -ma\dot{\theta }^{2}\sin \theta \]\[ \frac{\partial L}{\partial x}=-kx \] Hence, for the mass \(M\), the equation of motion is\begin{align} M\ddot{x}+m\ddot{x}+ma\ddot{\theta }\cos \theta -ma\dot{\theta }^{2}\sin \theta +kx & =F\nonumber \\ \ddot{x} & =\frac{F-kx-ma\ddot{\theta }\cos \theta +ma\dot{\theta }^{2}\sin \theta }{M+m}\tag{1} \end{align}
To find EQM for mass \(m\), evaluate \(\frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{\theta }}\right ) -\frac{\partial L}{\partial \theta }=0\)\[ \frac{\partial L}{\partial \dot{\theta }}=I_{g}\dot{\theta }+m\left ( a^{2}\dot{\theta }+\dot{x}a\cos \theta \right ) \]
\[ \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{\theta }}\right ) =I_{g}\ddot{\theta }+m\left ( a^{2}\ddot{\theta }-\dot{x}a\dot{\theta }\sin \theta +\ddot{x}a\cos \theta \right ) \]
\[ \frac{\partial L}{\partial \theta }=-m\dot{x}a\dot{\theta }\sin \theta +mga\sin \theta \] Hence EQM is\begin{align} \frac{d}{dt}\left ( \frac{\partial L}{\partial \dot{\theta }}\right ) -\frac{\partial L}{\partial \theta } & =0\nonumber \\ I_{g}\ddot{\theta }+m\left ( a^{2}\ddot{\theta }-\dot{x}a\dot{\theta }\sin \theta +\ddot{x}a\cos \theta \right ) +m\dot{x}a\dot{\theta }\sin \theta -mga\sin \theta & =0\nonumber \\ I_{g}\ddot{\theta }+ma^{2}\ddot{\theta }-m\dot{x}a\dot{\theta }\sin \theta +m\ddot{x}a\cos \theta +m\dot{x}a\dot{\theta }\sin \theta -mga\sin \theta & =0\nonumber \\ I_{g}\ddot{\theta }+ma^{2}\ddot{\theta }+m\ddot{x}a\cos \theta -mga\sin \theta & =0\nonumber \\ \ddot{\theta }\left ( I_{g}+ma^{2}\right ) & =mga\sin \theta -m\ddot{x}a\cos \theta \nonumber \\ \ddot{\theta } & =\frac{mga\sin \theta -m\ddot{x}a\cos \theta }{I_{g}+ma^{2}}\nonumber \\ & =\frac{mag\sin \theta -max^{\prime \prime }\cos \theta }{ma^{2}+I_{g}}\tag{2} \end{align}
Substitute Eq. (2) into Eq. (1) gives\[ x^{\prime \prime }=\frac{F\left ( t\right ) -kx-ma\left [ \frac{mag\sin \theta -max^{\prime \prime }\cos \theta }{ma^{2}+I_{g}}\right ] \cos \theta +ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{M+m}\] Let \(\left ( ma^{2}+I_{g}\right ) =I_{o}\), hence\begin{align} x^{\prime \prime } & =\frac{I_{o}F\left ( t\right ) -I_{o}kx-ma\left [ mag\sin \theta -max^{\prime \prime }\cos \theta \right ] \cos \theta +I_{o}ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{I_{o}\left ( M+m\right ) }\nonumber \\ I_{o}\left ( M+m\right ) x^{\prime \prime }-m^{2}a^{2}x^{\prime \prime }\cos \theta & =I_{o}F\left ( t\right ) -I_{o}kx-m^{2}a^{2}g\sin \theta \cos \theta +I_{o}ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \nonumber \\ x^{\prime \prime } & =\frac{I_{o}F\left ( t\right ) -I_{o}kx-m^{2}a^{2}g\sin \theta \cos \theta +I_{o}ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{I_{o}\left ( M+m\right ) -m^{2}a^{2}\cos \theta }\tag{3} \end{align}
Also, we can solve for \(\theta ^{\prime \prime }\) by Substituting Eq. (1) into (2)\[ \theta ^{\prime \prime }=\frac{mag\sin \theta -ma\left [ \frac{F\left ( t\right ) -kx-ma\theta ^{\prime \prime }\cos \theta +ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{M+m}\right ] \cos \theta }{ma^{2}+I_{g}}\] Let \(\left ( ma^{2}+I_{g}\right ) =I_{o}\), hence
Using the decoupled ODE’s above, Eqs (3) and (4), and introducing 4 state variables \(x_{1},x_{2},x_{3}\,x_{4}\) we obtain\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\end{pmatrix} & =\begin{pmatrix} x\\ \theta \\ x^{\prime }\\ \theta ^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} =\begin{pmatrix} x^{\prime }\\ \theta ^{\prime }\\ x^{\prime \prime }\\ \theta ^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{I_{o}F\left ( t\right ) -I_{o}kx-m^{2}a^{2}g\sin \theta \cos \theta +I_{o}ma\left ( \theta ^{\prime }\right ) ^{2}\sin \theta }{I_{o}\left ( M+m\right ) -m^{2}a^{2}\cos \theta }\\ \frac{\left ( M+m\right ) mag\sin \theta -maF\left ( t\right ) \cos \theta +makx\cos \theta -m^{2}a^{2}\left ( \theta ^{\prime }\right ) ^{2}\sin \theta \cos \theta }{I_{o}\left ( M+m\right ) -m^{2}a^{2}\cos ^{2}\theta }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{I_{o}F\left ( t\right ) -I_{o}kx_{1}-m^{2}a^{2}g\sin x_{2}\cos x_{2}+I_{o}ma\ x_{4}^{2}\sin x_{2}}{I_{o}\left ( M+m\right ) -m^{2}a^{2}\cos x_{2}}\\ \frac{\left ( M+m\right ) mag\sin x_{2}-maF\left ( t\right ) \cos x_{2}+makx\cos x_{2}-m^{2}a^{2}x_{4}^{2}\sin x_{2}\cos x_{2}}{I_{o}\left ( M+m\right ) -m^{2}a^{2}\cos ^{2}x_{2}}\end{pmatrix} \end{align*}
Only the velocity diagram is needed for the Lagrangian method. Generalized coordinates are: \(x,\theta ,r\)
Let \(L\) be the Lagrangian, and let \(T\) be the kinetic energy of the system, and \(V\) the potential energy.\begin{align*} T & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \left ( \dot{x}\cos \theta +\dot{\theta }r\right ) ^{2}+\left ( \dot{x}\sin \theta +\dot{r}\right ) ^{2}\right ) \\ V & =\frac{1}{2}kx^{2}+\frac{1}{2}k_{p}\left ( r-l_{0}\right ) ^{2}-mgr\cos \theta \end{align*}
Hence\begin{align*} L & =T-V\\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \left ( \dot{x}^{2}\cos ^{2}\theta +\dot{\theta }^{2}r^{2}+2\dot{x}\dot{\theta }r\cos \theta \right ) +\left ( \dot{x}^{2}\sin ^{2}\theta +\dot{r}^{2}+2\dot{r}\dot{x}\sin \theta \right ) \right ) \\ & -\left ( \frac{1}{2}kx^{2}+\frac{1}{2}k_{p}\left ( r-l_{0}\right ) ^{2}-mgr\cos \theta \right ) \\ & \\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+\dot{\theta }^{2}r^{2}+2\dot{x}\dot{\theta }r\cos \theta +\dot{r}^{2}+2\dot{r}\dot{x}\sin \theta \right ) -\frac{1}{2}kx^{2}-\frac{1}{2}k_{p}\left ( r-l_{0}\right ) ^{2}+mgr\cos \theta \end{align*}
For \(x\) we obtain\begin{align*} \frac{d}{dt}\frac{\partial L}{\partial \dot{x}}-\frac{\partial L}{\partial x} & =Q_{x}\\ kx+m\sin \theta \left ( -r\dot{\theta }^{2}+\ddot{r}\right ) +\left ( m+M\right ) \ddot{x}+m\cos \theta \left ( 2\dot{r}\dot{\theta }+r\ddot{\theta }\right ) & =Q_{x} \end{align*}
To find \(Q_{x}\) we make small \(\delta x\) displacement and find the virtual work done. Hence we obtain\[ \delta W=F\delta x \] Hence \(Q_{x}=F\left ( t\right ) \) and EQM for \(x\) becomes\[ kx+m\sin \theta \left ( -r\dot{\theta }^{2}+\ddot{r}\right ) +\left ( m+M\right ) \ddot{x}+m\cos \theta \left ( 2\dot{r}\dot{\theta }+r\ddot{\theta }\right ) =F \] Hence\begin{equation} \ddot{x}=\frac{F-kx-m\sin \theta \left ( -r\dot{\theta }^{2}+\ddot{r}\right ) -m\cos \theta \left ( 2\dot{r}\dot{\theta }+r\ddot{\theta }\right ) }{\left ( m+M\right ) }\tag{1} \end{equation} For \(r\) we obtain\begin{align*} \frac{d}{dt}\frac{\partial L}{\partial \dot{r}}-\frac{\partial L}{\partial r} & =Q_{r}\\ -k_{p}l_{0}-gm\cos \theta +r\left ( k_{p}-m\dot{\theta }^{2}\right ) +m\ddot{r}+m\ddot{x}\sin \theta & =Q_{r} \end{align*}
To find \(Q_{r}\) we make small \(\delta r\) displacement and find the virtual work done. Hence we obtain \(Q_{r}=0\) and EQM for \(r\) becomes\[ -k_{p}l_{0}-gm\cos \theta +r\left ( k_{p}-m\dot{\theta }^{2}\right ) +m\ddot{r}+m\ddot{x}\sin \theta =0 \] Hence\begin{equation} \ddot{r}=\frac{k_{p}l_{0}+gm\cos \theta -r\left ( k_{p}-m\dot{\theta }^{2}\right ) -m\ddot{x}\sin \theta }{m}\tag{2} \end{equation} For \(\theta \) we obtain\begin{align*} \frac{d}{dt}\frac{\partial L}{\partial \dot{\theta }}-\frac{\partial L}{\partial \theta } & =Q_{\theta }\\ mr\left ( g\sin \theta +2\dot{r}\dot{\theta }+\cos \theta \ddot{x}+r\ddot{\theta }\right ) & =Q_{\theta } \end{align*}
To find \(Q_{\theta }\) we make small \(\delta \theta \) displacement and find the virtual work done. Hence we obtain \(Q_{\theta }=0\) and EQM for \(\theta \) becomes\[ mr\left ( g\sin \theta +2\dot{r}\dot{\theta }+\cos \theta \ddot{x}+r\ddot{\theta }\right ) =0 \] Hence \begin{equation} \ddot{\theta }=\frac{-g\sin \theta -2\dot{r}\dot{\theta }-\ddot{x}\cos \theta }{r}\tag{3} \end{equation} To be able to convert to first order form, we need to decouple the above equations. This results in\begin{align*} \ddot{x} & =\frac{F\left ( t\right ) }{M}-\frac{k}{M}x-\frac{k_{p}}{M}\left ( r-l_{0}\right ) \sin \theta \\ \ddot{r} & =g\cos \theta -\frac{k_{p}}{m}\left ( r-l_{0}\right ) -\frac{F\left ( t\right ) }{M}\sin \theta +\frac{k}{M}x\sin \theta +\frac{k_{p}}{M}\left ( r-l_{0}\right ) \sin ^{2}\theta +\dot{\theta }^{2}r\\ \ddot{\theta } & =-\frac{g}{r}\sin \theta -\frac{2\dot{r}}{r}\dot{\theta }-\frac{F\left ( t\right ) }{rM}\cos \theta +\frac{k}{rM}x\cos \theta +\frac{k_{p}}{rM}\left ( r-l_{0}\right ) \sin \theta \cos \theta \end{align*}
Using the decoupled ODE’s above, and introducing 6 state variables \(x_{1},x_{2},x_{3,}\,x_{4},x_{5},x_{6}\) we obtain\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\\ x_{5}\\ x_{6}\end{pmatrix} & =\begin{pmatrix} x\\ \theta \\ r\\ x^{\prime }\\ \theta ^{\prime }\\ r^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\\ \dot{x}_{5}\\ \dot{x}_{6}\end{pmatrix} =\begin{pmatrix} x^{\prime }\\ \theta ^{\prime }\\ r^{\prime }\\ x^{\prime \prime }\\ \theta ^{\prime \prime }\\ r^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\\ \dot{x}_{5}\\ \dot{x}_{6}\end{pmatrix} & =\begin{pmatrix} x_{4}\\ x_{5}\\ x_{6}\\ \frac{F\left ( t\right ) }{M}-\frac{k}{M}x-\frac{k_{p}}{M}\left ( r-l_{0}\right ) \sin \theta \\ -\frac{g}{r}\sin \theta -\frac{2r^{\prime }}{r}\theta ^{\prime }-\frac{F\left ( t\right ) }{rM}\cos \theta +\frac{k}{rM}x\cos \theta +\frac{k_{p}}{rM}\left ( r-l_{0}\right ) \sin \theta \cos \theta \\ g\cos \theta -\frac{k_{p}}{m}\left ( r-l_{0}\right ) -\frac{F\left ( t\right ) }{M}\sin \theta +\frac{k}{M}x\sin \theta +\frac{k_{p}}{M}\left ( r-l_{0}\right ) \sin ^{2}\theta +\dot{\theta }^{2}r \end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\\ \dot{x}_{5}\\ \dot{x}_{6}\end{pmatrix} & =\begin{pmatrix} x_{4}\\ x_{5}\\ x_{6}\\ \frac{F\left ( t\right ) }{M}-\frac{k}{M}x_{1}-\frac{k_{p}}{M}\left ( x_{3}-l_{0}\right ) \sin x_{2}\\ -\frac{g}{r}\sin x_{2}-\frac{2x_{6}}{x_{3}}x_{5}-\frac{F\left ( t\right ) }{x_{3}M}\cos x_{2}+\frac{k}{x_{3}M}x_{1}\cos x_{2}+\frac{k_{p}}{x_{3}M}\left ( x_{3}-l_{0}\right ) \sin x_{2}\cos x_{2}\\ g\cos x_{2}-\frac{k_{p}}{m}\left ( x_{3}-l_{0}\right ) -\frac{F\left ( t\right ) }{M}\sin x_{2}+\frac{k}{M}x_{1}\sin x_{2}+\frac{k_{p}}{M}\left ( x_{3}-l_{0}\right ) \sin ^{2}x_{2}+x_{5}^{2}x_{3}\end{pmatrix} \end{align*}
Only the velocity diagram is needed for the Lagrangian method. Generalized coordinates are: \(x,\theta \)
Let \(L\) be the Lagrangian, and let \(T\) be the kinetic energy of the system, and \(V\) the potential energy.\begin{align*} T & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \left ( \dot{x}-L\dot{\theta }\right ) ^{2}+\left ( L\dot{\theta }\cos \theta \right ) ^{2}\right ) \\ V & =Mgx+mg\left ( L\cos \theta +x\right ) \end{align*}
Hence\begin{align*} L & =T-V\\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+L^{2}\dot{\theta }^{2}-2\dot{x}L\dot{\theta }+L^{2}\dot{\theta }^{2}\cos ^{2}\theta \right ) -Mgx-mg\left ( L\cos \theta +x\right ) \end{align*}
For \(x\) we obtain\begin{align*} \frac{d}{dt}\frac{\partial L}{\partial \dot{x}}-\frac{\partial L}{\partial x} & =Q_{x}\\ g\left ( m+M\right ) +\left ( m+M\right ) \ddot{x}-Lm\ddot{\theta } & =Q_{x} \end{align*}
To find \(Q_{x}\) we make small \(\delta x\) displacement and find the virtual work done. Hence we obtain\[ \delta W=F\delta x \] Therefore \(Q_{x}=F\) and the EQM for \(x\) becomes\[ g\left ( m+M\right ) +\left ( m+M\right ) \ddot{x}-Lm\ddot{\theta }=F \] Hence \begin{equation} \ddot{x}=\frac{F-g\left ( m+M\right ) +Lm\ddot{\theta }}{m+M}\tag{1} \end{equation}
For \(\theta \) we have
\begin{align*} \frac{d}{dt}\frac{\partial L}{\partial \dot{\theta }}-\frac{\partial L}{\partial \theta } & =Q_{\theta }\\ Lm\left ( g\sin \theta +L\dot{\theta }^{2}\cos \theta \sin \theta +\ddot{x}-L\ddot{\theta }\left ( 1+\cos ^{2}\theta \right ) \right ) & =Q_{\theta } \end{align*}
To find \(Q_{\theta }\) we make small \(\delta \theta \) displacement and find the virtual work done. We find that \(Q_{\theta }=0\) hence the EQM for \(\theta \) becomes
\begin{align*} Lm\left ( g\sin \theta +L\dot{\theta }^{2}\cos \theta \sin \theta +\ddot{x}-L\ddot{\theta }\left ( 1+\cos ^{2}\theta \right ) \right ) & =0\\ g\sin \theta +L\dot{\theta }^{2}\cos \theta \sin \theta +\ddot{x}-L\ddot{\theta }\left ( 1+\cos ^{2}\theta \right ) & =0 \end{align*}
Hence
\begin{equation} \ddot{\theta }=\frac{g\sin \theta +L\dot{\theta }^{2}\cos \theta \sin \theta +\ddot{x}}{L\left ( 1+\cos ^{2}\theta \right ) }\tag{2} \end{equation}
To convert to first form, Eqs. (1) and (2) are decoupled resulting in
\begin{align*} \ddot{x} & =\frac{\left ( F-g\left ( m+M\right ) \right ) \left ( 1+\cos ^{2}\theta \right ) +mg\sin \theta +Lm\dot{\theta }^{2}\cos \theta \sin \theta }{M+\left ( M+m\right ) \cos ^{2}\theta }\\ \ddot{\theta } & =\frac{F-g\left ( m+M\right ) +g\left ( m+M\right ) \sin \theta +L\left ( m+M\right ) \dot{\theta }^{2}\cos \theta \sin \theta }{L\left ( M+\left ( M+m\right ) \cos ^{2}\theta \right ) } \end{align*}
Using the decoupled ODE’s above, and introducing 4 state variables \(x_{1},x_{2},x_{3,}\,x_{4}\) we obtain\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\end{pmatrix} & =\begin{pmatrix} x\\ \theta \\ x^{\prime }\\ \theta ^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} =\begin{pmatrix} x^{\prime }\\ \theta ^{\prime }\\ x^{\prime \prime }\\ \theta ^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{\left ( F-g\left ( m+M\right ) \right ) \left ( 1+\cos ^{2}\theta \right ) +mg\sin \theta +Lm\dot{\theta }^{2}\cos \theta \sin \theta }{M+\left ( M+m\right ) \cos ^{2}\theta }\\ \frac{F-g\left ( m+M\right ) +g\left ( m+M\right ) \sin \theta +L\left ( m+M\right ) \dot{\theta }^{2}\cos \theta \sin \theta }{L\left ( M+\left ( M+m\right ) \cos ^{2}\theta \right ) }\end{pmatrix} \\ & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{\left ( F-g\left ( m+M\right ) \right ) \left ( 1+\cos ^{2}x_{2}\right ) +mg\sin x_{2}+Lmx_{4}^{2}\cos x_{2}\sin x_{2}}{M+\left ( M+m\right ) \cos ^{2}x_{2}}\\ \frac{F-g\left ( m+M\right ) +g\left ( m+M\right ) \sin x_{2}+L\left ( m+M\right ) x_{4}^{2}\cos x_{2}\sin x_{2}}{L\left ( M+\left ( M+m\right ) \cos ^{2}x_{2}\right ) }\end{pmatrix} \end{align*}
Only the velocity diagram is needed for the Lagrangian method.
Let \(L\) be the Lagrangian, and let \(T\) be the kinetic energy of the system, and \(V\) the potential energy.\begin{align*} T & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}+R\dot{\theta }\right ) ^{2}+\frac{1}{2}I_{g}\dot{\theta }^{2}\\ V & =\frac{1}{2}k\left ( R\theta \right ) ^{2} \end{align*}
Hence\begin{align*} L & =T-V\\ & =\left [ \frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}+R\dot{\theta }\right ) ^{2}+\frac{1}{2}I_{g}\dot{\theta }^{2}\right ] -\frac{1}{2}k\left ( R\theta \right ) ^{2}\\ & =\frac{1}{2}M\dot{x}^{2}+\frac{1}{2}m\left ( \dot{x}^{2}+R^{2}\dot{\theta }^{2}+2\dot{x}\dot{\theta }R\right ) +\frac{1}{2}I_{g}\dot{\theta }^{2}-\frac{1}{2}kR^{2}\theta ^{2} \end{align*}
and\begin{align*} \frac{\partial L}{\partial \dot{x}} & =M\dot{x}+m\dot{x}+m\dot{\theta }R\\ \frac{\partial L}{\partial x} & =0\\ \frac{d}{dt}\frac{\partial L}{\partial \dot{x}} & =M\ddot{x}+m\ddot{x}+m\ddot{\theta }R \end{align*}
Hence, for \(x\), the EQM is\[ M\ddot{x}+m\ddot{x}+m\ddot{\theta }R=Q_{x}\] Where \(Q_{x}\) is the generalized force which is\begin{align*} \delta W & =\frac{F\delta x+\left ( kR\theta \right ) \delta x+\left ( bR\dot{\theta }\right ) \delta x}{\delta x}\\ & =F+bR\dot{\theta }+kR\theta \end{align*}
hence\begin{align*} M\ddot{x}+m\ddot{x}+m\ddot{\theta }R & =F\left ( t\right ) +bR\dot{\theta }+kR\theta \\ \ddot{x} & =\frac{F\left ( t\right ) +bR\dot{\theta }+kR\theta -m\ddot{\theta }R}{M+m} \end{align*}
Since \(I_{g}=\frac{mR^{2}}{2}\), then the above can be written as\[ \ddot{x}=\frac{RF\left ( t\right ) +bR^{2}\dot{\theta }+kR^{2}\theta -2I_{g}\ddot{\theta }}{R\left ( M+m\right ) }\] For \(\theta \), the EQM is\begin{align*} \frac{\partial L}{\partial \dot{\theta }} & =m\left ( R^{2}\dot{\theta }+\dot{x}R\right ) +I_{g}\dot{\theta }\\ \frac{\partial L}{\partial \theta } & =-kR^{2}\theta \\ \frac{d}{dt}\frac{\partial L}{\partial \dot{x}} & =m\left ( R^{2}\ddot{\theta }+\ddot{x}R\right ) +I_{g}\ddot{\theta } \end{align*}
Hence\[ m\left ( R^{2}\ddot{\theta }+\ddot{x}R\right ) +I_{g}\ddot{\theta }+kR^{2}\theta =F_{\theta }\] In this case, \(\delta W=-\frac{\left ( bR\dot{\theta }\right ) R\delta \theta }{\delta \theta }\), hence \(F_{\theta }=-bR^{2}\dot{\theta }\), therefore, the EQM is\begin{align*} m\left ( R^{2}\ddot{\theta }+\ddot{x}R\right ) +I_{g}\ddot{\theta }+kR^{2}\theta & =-bR^{2}\dot{\theta }\\ \ddot{\theta } & =\frac{-bR^{2}\dot{\theta }-kR^{2}\theta -m\ddot{x}R}{I_{g}+mR^{2}}\\ & =-\frac{bR^{2}\dot{\theta }+kR^{2}\theta +m\ddot{x}R}{I_{o}} \end{align*}
By decoupling the 2 equations of motion we obtain\begin{align*} x^{\prime \prime } & =\frac{I_{o}F\left ( t\right ) +kI_{o}R\theta +bI_{o}R\theta ^{\prime }+I_{g}\left [ kR\theta +bR\theta ^{\prime }\right ] }{MI_{o}-I_{g}m}\\ \theta ^{\prime \prime } & =\frac{-mRF\left ( t\right ) -mkR^{2}\theta -mbR^{2}\theta ^{\prime }-MkR^{2}\theta -MbR^{2}\theta ^{\prime }}{MI_{o}-I_{g}m} \end{align*}
Using the decoupled ODE’s above, and introducing 4 state variables \(x_{1},x_{2},x_{3,}\,x_{4}\) we obtain\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\end{pmatrix} & =\begin{pmatrix} x\\ \theta \\ x^{\prime }\\ \theta ^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} =\begin{pmatrix} x^{\prime }\\ \theta ^{\prime }\\ x^{\prime \prime }\\ \theta ^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{I_{o}F\left ( t\right ) +kI_{o}R\theta +bI_{o}R\theta ^{\prime }+I_{g}\left [ kR\theta +bR\theta ^{\prime }\right ] }{MI_{o}-I_{g}m}\\ \frac{-mRF\left ( t\right ) -mkR^{2}\theta -mbR^{2}\theta ^{\prime }-MkR^{2}\theta -MbR^{2}\theta ^{\prime }}{MI_{o}-I_{g}m}\end{pmatrix} \\ & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{I_{o}F\left ( t\right ) +kI_{o}Rx_{2}+bI_{o}Rx_{4}+I_{g}\left [ kRx_{2}+bRx_{4}\right ] }{MI_{o}-I_{g}m}\\ \frac{-mRF\left ( t\right ) -mkR^{2}x_{2}-mbR^{2}x_{4}-MkR^{2}x_{2}-MbR^{2}x_{4}}{MI_{o}-I_{g}m}\end{pmatrix} \end{align*}