Pendulum hanging from a spring-mounted cart
A cart of mass $M$ moves without friction and is held between two walls by springs of stiffness $k$. A massless rod of length $a$, pivoted on the cart, carries a point mass $m$. The coordinates are the cart displacement $x$ and the rod angle $\theta$ from the vertical. Find the equations of motion, including small oscillations.
Explanation of Method
Derive the nonlinear equations with the variational method and linearize them for small angles. The simulator shows the real time scale, the two normal modes, and the energy exchange between the cart and the pendulum.
A cart of mass M, held between two walls by two springs, carries a pendulum of mass m on a light rod of length a. The two degrees of freedom are coupled through inertia: the swinging pendulum pushes the cart, and the moving cart drives the pendulum. The paper derives the nonlinear and linearized equations with the variational method and simulates both in Simulink. The derivation is correct. However, the paper's plots use the output sample number, not time, on the horizontal axis. The interactive simulator reproduces this and shows the real time scale, normal modes and energy exchange.
Problem statement
Derive the equations of motion of the system shown in the figure. Consider separately the case of small oscillations.
- A cart of mass \(M\) moves without friction on a horizontal surface. It is connected to two fixed walls by two springs of stiffness \(k\).
- A rigid, massless rod of length \(a\) is pivoted on the cart and carries a point mass \(m\) at its end.
- The generalized coordinates are the cart displacement \(x\) and the rod angle \(\theta\) from the vertical.
The system is idealized: there is no friction anywhere and no external force other than gravity. It starts moving only when it is displaced from equilibrium (\(x=0\), \(\theta=0\)).
Energies of the system
Potential energy
When the cart moves by \(x\), one spring is compressed and the other is stretched by the same amount (\(x_1=-x_2\)). Squared, both give the same energy. The pendulum mass rises by \(a(1-\cos\theta)\):
The two springs act like one spring of stiffness \(2k\) (they are in parallel, since they share the same displacement).
Kinetic coenergy
The cart moves with \(v_M=\dot x\). The pendulum mass has the cart's velocity \(\dot x\) (horizontal) plus the relative velocity \(a\dot\theta\) (perpendicular to the rod). The angle between them is \(\theta\), so the cosine rule gives
Lagrangian
Equations of motion
Coordinate \(x\)
Coordinate \(\theta\)
The \(\dot x\dot\theta\sin\theta\) terms cancel. After dividing by \(ma\):
The derivation is correct. The paper writes partial derivatives with \(\Delta\) instead of \(\partial\), which is only a matter of notation. Equation (II) has a clear physical meaning. In the cart's accelerating frame, the pendulum feels gravity \(g\) and an inertial acceleration \(-\ddot x\), and only their components perpendicular to the rod turn it.
Matrix form
For the simulation, both accelerations are obtained at once from
(Here (II) is multiplied by \(ma\), which makes the mass matrix symmetric.) Its determinant \(ma^2(M + m\sin^2\theta)\) is always positive.
Small oscillations
With \(\sin\theta\approx\theta\) and \(\cos\theta\approx1\), and dropping the term \(\dot\theta^2\sin\theta\) (of third order), the paper obtains
This is a correct linearization. The paper states the approximations \(\sin\theta\approx\theta\) and \(\cos\theta\approx1\) explicitly, but drops the velocity term without comment. It should mention that this term is negligible because it is of third order in small quantities.
Simulink models
- Nonlinear model (I)–(II): the top chain of two integrators gives \(x\), the bottom chain gives \(\theta\). Product blocks form \(\ddot\theta\cos\theta\), \(\dot\theta^2\sin\theta\) (with \(\dot\theta^2\) from a product of \(\dot\theta\) with itself) and \(\ddot x\cos\theta\). Gains \(2k/(M+m)\), \(ma/(M+m)\), \(1/a\) and \(g/a\) close the loops. Each chain uses the other's acceleration, so the diagram contains an algebraic loop.
- Linear model (III): the same two chains with only gains (\(2k/(M+m)\), \(ma/(M+m)\), \(1/a\), \(g/a\)).
- The outputs go to the workspace as pomjeraj (displacement \(x\)), ugao (angle \(\theta\)) and t (time).
Base parameters: \(M=2\) kg, \(m=0.5\) kg, \(k=3\) N/m, \(a=1\) m, \(g=9.81\) m/s². The initial conditions are set on the integrators: \(x(0)=1\) m and/or \(\theta(0)=1\) rad.
Simulation results from the paper
| Plot | Parameters (M, m, k, a) | Initial state | |
|---|---|---|---|
| Cart displaced | 2, 0.5, 3, 1 | x = 1, θ = 0 | |
| Pendulum displaced | 2, 0.5, 3, 1 | x = 0, θ = 1 rad | |
| Both displaced | 2, 0.5, 3, 1 | x = 1, θ = 1 rad | |
| Parameter set A | 0.5, 2, 3, 1 | x = 1 | |
| Parameter set B | 5, 1, 100, 2 | θ = 1 rad | |
| Parameter set C | 1, 10, 5, 2 | x = 1 | |
| Parameter set D | 1, 5, 10, 0.3 | θ = 1 rad | |
| Linear vs nonlinear, small | 2, 0.5, 3, 1 | x = 1, θ = 0 | |
| Linear vs nonlinear, large | 2, 0.5, 3, 1 | x = 20, θ = 0 |
The paper's observations are as follows:
- Displacing only the cart, only the pendulum, or both gives different patterns. In each, a slow and a faster oscillation are superimposed.
- Changing any parameter or the initial values changes the motion.
- For \(x(0)=1\) the linear and nonlinear models give practically identical curves.
- For \(x(0)=20\) they differ greatly, so the linear model "can be used only when we know that the system will oscillate with small oscillations".
Critical review
The horizontal axis is the sample number, not time
The plots are labelled "time" (vrijeme), but the axis runs to about 55–60 in the base cases. Several features show that the variables were plotted against their index, e.g. plot(pomjeraj) instead of plot(t, pomjeraj):
- Every curve starts with a flat segment about 5–7 units long. That is where the variable-step solver takes very small first steps.
- The curves consist of straight segments of unequal length.
- Simulating 10 s with Simulink's default settings (ode45, relative tolerance 10⁻³, maximum step = stop time / 50) gives about 55 output points. Plotted against the index, the result reproduces the paper's first three plots almost exactly.
Because the steps have unequal length, the time axis is distorted. Periods cannot be read from the plots, and the flat start suggests a delay that does not exist. The simulator has a "Simulink sample view" chart that shows this effect next to the true time axis.
"Large" oscillations: what is actually large?
The linear model's error does not depend on how far the cart moves. The \(x\)-equation is linear in \(x\) anyway. It depends on the pendulum angle. With \(x(0)=20\) m the cart's motion drives the pendulum to about 2.8 rad (160°) in the nonlinear model within 10 s. The linear model, whose response simply scales with the initial value, predicts over 10 rad. Even the paper's "small" case \(x(0)=1\) m is not that small for the pendulum: it swings up to 31°, and the two models differ by up to 0.10 rad (6°) within 10 s. On the coarse plots this is hard to see. A better test of the linearization is the angle reached, e.g. \(\theta(0) = 5^\circ\) vs \(60^\circ\). Also, a 20 m displacement of a 2 kg cart on 3 N/m springs is hardly realistic.
Smaller points
The plots have no units, and both variables share one axis even though \(x\) is in metres and \(\theta\) in radians. The phrase "parameters often met in practice" is not justified. The parameter study shows plots but no conclusions about how the frequencies depend on \(M\), \(m\), \(k\) and \(a\). The two natural frequencies, which explain all the patterns seen, are never computed (section 8).
Extension: normal modes and energy exchange
Writing (III) as \(\mathbf M\ddot{\mathbf q} + \mathbf K\mathbf q = \mathbf 0\) with \(\mathbf q = [x,\ \theta]^T\) (second equation multiplied by \(ma\)):
The condition \(\det(\mathbf K-\omega^2\mathbf M)=0\) gives, after dividing by \(ma\),
| Parameters (M, m, k, a) | ω₁, ω₂ [rad/s] | Periods [s] | Mode shapes θ/x [rad/m] |
|---|---|---|---|
| 2, 0.5, 3, 1 (base) | 1.51, 3.61 | 4.18, 1.74 | +0.30, −4.08 |
| 0.5, 2, 3, 1 (A) | 1.41, 7.69 | 4.45, 0.82 | +0.26, −1.20 |
| 5, 1, 100, 2 (B) | 2.19, 6.41 | 2.88, 0.98 | +17.9, −0.57 |
| 1, 10, 5, 2 (C) | 0.88, 7.95 | 7.13, 0.79 | +0.09, −0.54 |
| 1, 5, 10, 0.3 (D) | 1.75, 14.60 | 3.59, 0.43 | +0.35, −3.94 |
- In the slow mode the pendulum swings in the same direction as the cart's displacement (\(\theta/x>0\)). In the fast mode it swings against it, and the cart moves the other way.
- The two frequencies always bracket the "uncoupled" frequencies \(\sqrt{2k/M}\) and \(\sqrt{g/a}\). The coupling pushes them apart.
- Displacing only the cart or only the pendulum excites a mixture of both modes. That is why every plot in the paper shows a slow wave with a faster ripple. Releasing the system in a mode shape (presets "Mode 1" and "Mode 2") gives a pure single-frequency motion.
- If the uncoupled frequencies are nearly equal (\(2k/M \approx g/a\)) and \(m\ll M\), the two modes are close together. Energy then moves slowly back and forth between the cart and the pendulum (beats), as in the preset "Tuned". This is the principle of a pendulum-type vibration absorber.
Without damping, the total energy \(E = \mathcal{R}^* + \mathcal{A}\) is conserved. It is a useful check of any simulation.
Interactive simulator
The main charts use a fixed-step 4th-order Runge–Kutta method (1 ms) on a true time axis. The "Simulink sample view" repeats the run with an adaptive Dormand–Prince (ode45) solver at Simulink's default settings and plots the samples against their index, as in the paper.
Cases
System parameters
Angle fields accept expressions, e.g. 180/pi for 1 rad.
Results table (every 0.05 s)
Review questions
Why do the two springs appear as \(kx^2\) and not \(\tfrac12kx^2\)?
Each spring stores \(\tfrac12kx^2\), since one is compressed and the other stretched by \(x\). Together they store \(kx^2\), i.e. they act as one spring of stiffness \(2k\).
Why does the pendulum start to swing when only the cart is displaced?
The springs accelerate the cart, and in the cart's frame the pendulum feels an inertial force \(-m\ddot x\). In the equations this is the coupling term \(\ddot x\cos\theta\) in (II). The coupling is inertial: the stiffness matrix of the linear model is diagonal.
How can you tell that the paper's horizontal axis is not time?
The flat initial segment and the polygonal curves with unequal segment lengths are typical of a variable-step solver's output plotted against its index. Plotting against t (or using a fixed output step) removes both effects.
For which initial state does the system oscillate at a single frequency?
For release from rest with \(\theta(0)/x(0)\) equal to a mode shape from (IV), e.g. \(\theta/x = 0.30\) rad/m (slow mode) or \(-4.08\) rad/m (fast mode) for the base parameters, at small amplitude.
What limits the validity of the linear model in this system?
Only the pendulum angle, since the cart equation is linear in \(x\). The linear model is good while \(\theta\) stays within roughly 10–20°, whatever the cart displacement.
What happens if \(m \to 0\)?
The cart no longer feels the pendulum: \(\omega_1 = \sqrt{2k/M}\). The pendulum is still driven by the cart and has its own frequency \(\sqrt{g/a}\). The coupling becomes one-way.