Lite / Independent Engineering Research / Week 14
Second-order systems as two-state models
A rover's suspension bounces after every rock. One second-order equation, or two first-order ones: which can a computer step forward?
Why should I care?
Most physical systems are second order: springs, pendulums, suspensions, attitude dynamics. Turning them into two-state form lets you simulate them, and lets a Kalman filter estimate the velocity you never directly measure.
- Rewrite m·ẍ + c·ẋ + k·x = u as two first-order equations.
- Discretise the model with Euler's method and build A and B.
- Check the discrete model's stability and the effect of the time step.
Predict
You simulate an undamped spring with forward Euler and a fairly large time step. What happens to the oscillation amplitude?
- Stays constant
- Slowly grows
- Slowly shrinks
- Stops immediately
Guess first, then reveal
Forward Euler adds energy to undamped oscillators: the discrete eigenvalues have |λ| = √(1 + ω²Δt²) > 1. A numerical artefact, not physics.
Discover
In the Robotics Workbench (or Code Lab), model one wheel's suspension: m = 1 kg, k = 4 N/m, c = 1 N·s/m. Build A = [[1, Δt], [−kΔt/m, 1 − cΔt/m]] for Δt = 0.1 s, release it from x = 0.1 m, and step it 100 times. Then set c = 0 and watch forward Euler pump energy in.
What the interactive shows (text version)
The simulation can be followed as a table of x and v at each step; the key result (|λ| ≈ 0.970 with damping, growth with c = 0) is stated in the text.
Understand
Two states from one equation
Choose x₁ = x (position) and x₂ = ẋ (velocity). Then ẋ₁ = x₂ and ẋ₂ = (u − c·x₂ − k·x₁)/m. In matrix form ẋ = F·x + G·u with F = [[0, 1], [−k/m, −c/m]] and G = [0, 1/m]ᵀ.
Discretise
Forward Euler: x[k+1] = x[k] + Δt·(F·x[k] + G·u[k]), so A = I + Δt·F and B = Δt·G. For m = 1, k = 4, c = 1, Δt = 0.1: A = [[1, 0.1], [−0.4, 0.9]], B = [0, 0.1]ᵀ. Its eigenvalues are complex with |λ| = √det(A) = √0.94 ≈ 0.970: a decaying oscillation.
Time step matters
The continuous system is stable for any c > 0, but the discrete model can disagree if Δt is too large. Smaller steps, or better integrators (semi-implicit Euler, Runge–Kutta, or the exact matrix exponential), keep the simulation faithful. Always check |λ| of the A you actually run.
Explain it another way
Intuitive
Position alone cannot tell you where a bouncing wheel is going next: it could be on its way up or on its way down. Add velocity and the future is determined.
Technical
Natural frequency ωₙ = √(k/m) = 2 rad/s, damping ratio ζ = c/(2√(km)) = 0.25. Continuous poles s = −ζωₙ ± jωₙ√(1 − ζ²) = −0.5 ± 1.94j.
Mathematical
For a 2 × 2 matrix with complex eigenvalues, |λ|² = det(A). det [[1, 0.1], [−0.4, 0.9]] = 0.9 + 0.04 = 0.94. With c = 0: det = 1 + 0.04 = 1.04 > 1: Euler makes the frictionless spring grow.
Applied
Spacecraft attitude about one axis is a two-state model (angle, rate) driven by reaction-wheel torque. Star trackers measure the angle; gyros measure the rate; the filter needs both states.
Worked example 1
m = 2 kg, k = 8 N/m, c = 2 N·s/m, Δt = 0.05 s. Write A.
F = [[0, 1], [−4, −1]]. A = I + 0.05F = [[1, 0.05], [−0.2, 0.95]].
Common mix-ups
If the physics is stable, the simulation is stable.
✓ The discretised A has its own eigenvalues; a large Δt can make a stable system simulate as unstable.You need a sensor for every state.
✓ Unmeasured states can be estimated if the system is observable: their effect shows up in the measured ones over time.
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
Find the largest Δt for which forward Euler keeps the m = 1, k = 4, c = 1 suspension stable (solve det(A) < 1 with A = I + ΔtF). Check your answer by simulation.
Reflect
What is one system in your life that needs two states to predict, and what are they?
Write your answer on paper or in your own notes. Lite never stores what you write.