Lite / Independent Engineering Research / Week 6
Mass–spring systems in state space
Why do simulators, controllers and estimators all insist on first-order equations, even for a second-order mass on a spring?
Why should I care?
State space is the common language of simulation, control and estimation. Once a model is x′ = Ax (+ Bu), the same eigenvalue tools, the same integrators and, next term, the same Kalman filter apply to it.
- Rewrite an nth-order linear ODE as a first-order system x′ = Ax.
- Link the eigenvalues of A to the characteristic roots and to the phase portrait.
- Classify an equilibrium (node, spiral, saddle, centre) from tr A and det A.
Predict
For x″ + 3x′ + 2x = 0 written as a state-space system, what are the eigenvalues of A?
- 3 and 2
- −1 and −2
- 1 and 2
Guess first, then reveal
A = [[0, 1], [−2, −3]] has λ² + 3λ + 2 = 0, the same as the characteristic equation r² + 3r + 2 = 0: λ = −1, −2.
Discover
Switch to 'Any 2×2 matrix'. Find settings that give each type: stable node, stable spiral, centre, saddle, unstable spiral. For each, record the signs of tr A and det A and of tr² − 4det.
What the interactive shows (text version)
In general mode, four sliders set the entries of A. The phase portrait shows direction arrows, trajectories and real eigen-lines; text gives the trace, determinant, discriminant, eigenvalues and the equilibrium type.
Watch (optional)
Watch for: Strang solves du/dt = Au by eigenvectors. Note his stability condition on the real parts.
Solves du/dt = Au with eigenvalues and eigenvectors and states the stability test on their real parts.
“23. Differential Equations and exp(At)” by MIT OpenCourseWare (opens YouTube; streaming video uses a lot of data)
The video is optional. Everything you need is in this lesson's text.
Understand
The general recipe
For an nth-order equation, use the output and its first n − 1 derivatives as states. With several masses, use every position and every velocity. With inputs, x′ = Ax + Bu. The state is everything you need to know now to predict the future.
Classifying equilibria
For 2×2 A: det < 0 gives a saddle (one positive and one negative real eigenvalue). det > 0 and tr² > 4det gives a node (two real eigenvalues of the same sign). det > 0 and tr² < 4det gives a spiral (complex pair). tr = 0 with det > 0 gives a centre. Stable if tr < 0 and det > 0.
Eigenvectors in the portrait
For real eigenvalues, the eigenvectors are straight-line trajectories: start on one and you stay on it, moving in or out like e^{λt}. Near a stable node, trajectories arrive along the slower eigenvector, because the faster mode has already died away.
Explain it another way
Intuitive
A phase portrait is a weather map for the state: at every point an arrow says where it goes next. Equilibria are calm spots; eigen-lines are the main roads.
Technical
The solution is x(t) = e^{At}x(0), where the matrix exponential equals V e^{Λt} V⁻¹ for diagonalisable A.
Applied
An inverted pendulum (a balancing robot) linearised about upright is a saddle: one unstable mode, which the controller must move into the left half-plane.
Derivation: From x″ to x′ = Ax, and back to the characteristic equation
Start from m x″ + c x′ + k x = 0. Choose states x₁ = x (position) and x₂ = x′ (velocity).
Then x₁′ = x₂ and x₂′ = x″ = −(k/m)x₁ − (c/m)x₂.
In matrix form: (x₁, x₂)′ = [[0, 1], [−k/m, −c/m]]·(x₁, x₂). Call the matrix A.
det(A − λI) = (−λ)(−c/m − λ) + k/m = λ² + (c/m)λ + k/m. Multiplying by m gives m λ² + c λ + k: the characteristic equation.
So tr A = −c/m (damping) and det A = k/m (stiffness), and the eigenvalues of A are the roots r. Solutions are x(t) = Σ cᵢ e^{λᵢt} vᵢ.
Worked example 1
Classify x′ = [[1, 2], [3, 0]]x.
tr = 1, det = 0 − 6 = −6 < 0: a saddle. λ² − λ − 6 = 0 gives λ = 3, −2. Unstable along the λ = 3 eigenvector (1, 1).
Common mix-ups
State-space models are only for control engineers.
✓ They are the standard input format for numerical integrators and estimators too.Stable means no oscillation.
✓ A stable spiral oscillates while decaying.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Write the state-space model of two masses joined by springs (four states). Use eig in the Code Lab to find its eigenvalues with and without damping, and explain why the undamped ones are purely imaginary.
Reflect
Which do you find more informative for a 2×2 system: the formula, or the phase portrait?
Write your answer on paper or in your own notes. Lite never stores what you write.