We are asked to write a program to simulation the equation of motion of the following spring pendulum shown in the textbook on page 42
Here is 45 MB AVI movie showing the program I wrote to solve this problem. pendulum.avi
To run the program, download this code.zip and extract it. It will create a new folder called code
Next, add this folder to your Matlab path (using Matlab file-> set path).
Then from Matlab command window, type eme_121_lab1
See also PDF
Notice that the \(r\) generalized coordinate is measured from the corner where the spring is attached to and not from the static equilibrium position. This diagram below helps to illustrate this more.
Now the equations of motion are found and then they are converted to state form description and then ODE solver was used to integrate them.
This system is 2 degree of freedom system, since two generalized coordinates are required to uniquely locate the mass \(m\) at any point of time. Hence, two EQM’s (equation of motions) are required.
Applying \(F=ma\) in the radial spring direction results in the following EQM
\[ -T+mg\cos \theta =m(r^{\prime \prime }-r\left ( \theta ^{\prime }\right ) ^{2}) \]
Rearranging, and noting that \(T=k\left ( r-l_{0}\right ) \) we obtain
\begin{equation} r^{\prime \prime }=r\left ( \theta ^{\prime }\right ) ^{2}+g\cos \theta -\frac{k}{m}\left ( r-l_{0}\right ) \tag{1} \end{equation}
Applying \(F=ma\) in the perpendicular direction to the spring results in the following EQM
\begin{align} -mg\sin \theta & =m\left ( r\theta ^{\prime \prime }+2r^{\prime }\theta ^{\prime }\right ) \nonumber \\ \theta ^{\prime \prime } & =-\frac{g}{r}\sin \theta -\frac{2r^{\prime }\theta ^{\prime }}{r}\tag{2} \end{align}
To use the ODE solver, the above second order ODE’s, Eqs., (1) and (2), need to be converted to first order ODE. This is done by introducing state variables as follows
\[ \left . \begin{array} [c]{c}x_{1}=r\\ x_{2}=r^{\prime }\\ x_{3}=\theta \\ x_{4}=\theta ^{\prime }\end{array} \right \} \overset{\frac{d}{dt}}{\rightarrow }\left . \begin{array} [c]{l}x_{1}^{\prime }=x_{2}\\ x_{2}^{\prime }=x_{1}x_{4}^{2}+g\cos x_{3}-\frac{k}{m}\left ( x_{1}-l_{0}\right ) \\ x_{3}^{\prime }=x_{4}\\ x_{4}^{\prime }=-\frac{g}{r}\sin x_{3}-\frac{2x_{2}x_{4}}{x_{1}}\end{array} \right \} \]
Therefore, the state space form is
\begin{equation} \begin{pmatrix} x_{1}^{\prime }\\ x_{2}^{\prime }\\ x_{3}^{\prime }\\ x_{4}^{\prime }\end{pmatrix} =\begin{pmatrix} x_{2}\\ x_{1}x_{4}^{2}+g\cos x_{3}-\frac{k}{m}\left ( x_{1}-l_{0}\right ) \\ x_{4}\\ \frac{g}{r}\sin x_{3}-\frac{2x_{2}x_{4}}{x_{1}}\end{pmatrix} \tag{3} \end{equation}
The above system is solved using ODE solver and the result are shown in the following section.
Using the following parameters to generate figure (3.2) and figure 3.3 for the very stiff spring
\(m\) | \(f\) | \(l_{0}\) | \(r\left ( 0\right ) \) | \(r^{\prime }\left ( 0\right ) \) | \(\theta \left ( 0\right ) \) | \(\theta ^{\prime }\left ( 0\right ) \) |
\(5kg\) | \(1000\ Hz\) | \(1\ m\) | \(1\ m\) | \(0\) | \(45^{0}\) | \(0\) |
Using the following parameters to generate figure (3.4)
\(m\) | \(f\) | \(l_{0}\) | \(r\left ( 0\right ) \) | \(r^{\prime }\left ( 0\right ) \) | \(\theta \left ( 0\right ) \) | \(\theta ^{\prime }\left ( 0\right ) \) |
\(5kg\) | \(1\ Hz\) | \(1\ m\) | \(1\ m\) | \(0\) | \(45^{0}\) | \(0\) |
Using the following parameters to generate figure (3.5)
\(m\) | \(f\) | \(l_{0}\) | \(r\left ( 0\right ) \) | \(r^{\prime }\left ( 0\right ) \) | \(\theta \left ( 0\right ) \) | \(\theta ^{\prime }\left ( 0\right ) \) |
\(5kg\) | \(1\ Hz\) | \(1\ m\) | \(2\ m\) | \(0\) | \(55^{0}\) | \(0\) |
When the spring is made very stiff, then the change of the pendulum length can be seen from the figure 3.3 result to be very small. This is the same result as a normal pendulum will have. This is also verified by figure 3.2 which shows a simple harmonic motion as shown in figure 3.2 (pendulum angle vs. time).
When the spring stiffness is reduced (\(f=1Hz\)), then we can see that the motion is no longer a simple harmonic motion as can be seen in figure (3.3 and 3.4). Changing the length of the initial pendulum also resulted is completely different profile of the motion.
l.198 — TeX4ht warning — “SaveEverypar’s: 2 at “begindocument and 3 “enddocument —