Skip to content
Tactiverge

School/✦ Research Engineer/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?

About 45 min · 3 goals · Checked by automated tests

1.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.

2.Predict

For x″ + 3x′ + 2x = 0 written as a state-space system, what are the eigenvalues of A?

Guess first. Being wrong here is how the surprise works.

3.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.

Loading the interactive…

Can't use the interactive? Read a description instead

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.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

For m x″ + c x′ + k x = F(t), which state vector works?

5.Watch

→ 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.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

6.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

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.

Derivation: From x″ to x′ = Ax, and back to the characteristic equation
  1. Start from m x″ + c x′ + k x = 0. Choose states x₁ = x (position) and x₂ = x′ (velocity).

  2. Then x₁′ = x₂ and x₂′ = x″ = −(k/m)x₁ − (c/m)x₂.

  3. In matrix form: (x₁, x₂)′ = [[0, 1], [−k/m, −c/m]]·(x₁, x₂). Call the matrix A.

  4. det(A − λI) = (−λ)(−c/m − λ) + k/m = λ² + (c/m)λ + k/m. Multiplying by m gives m λ² + c λ + k: the characteristic equation.

  5. 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.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

tr A = −1, det A = 2. The origin is a…

Practice 3 · a fresh version every time

A = [[-1, 0], [0, 1]]. Find its larger eigenvalue.

Practice 4

In state space, m = 2 kg and c = 3 N·s/m. What is tr A?

Practice 5

A linearised model has a saddle at its equilibrium. Practically, this means…

8.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.

9.Reflect

Concepts: Ordinary differential equations and state space · Eigenvalues and the stability of dynamic systems