System Dynamics · Module 9 of 10
State-Space Modeling and Simulation
Collect the energy variables into a state vector and the whole model becomes one matrix equation. The eigenvalues of that matrix are the poles, and the form is exactly what a computer integrates to simulate.
Readiness check
This module recasts models in matrix form. Tick only what you can do closed-notes.
- Multiply a matrix by a vector.
- Find the eigenvalues of a 2 by 2 matrix.
- Write a second-order equation as two first-order ones.
- Recall that poles set the response.
- Recall ωn and ζ from a complex pole pair.
The core idea
A state-space model writes a system as ẋ = Ax + Bu, y = Cx + Du, where x holds the energy variables. The eigenvalues of the state matrix A are the system poles, and the form is what numerical solvers integrate.
ẋ = A x + B uy = C x + D ueigenvalues of A = polesState-space modeling gathers the independent energy variables, positions and velocities, charges and currents, into a single state vector x. The dynamics then take the compact matrix form ẋ = Ax + Bu, where A is the state matrix that governs the system's own behaviour and B couples in the input u; an output equation y = Cx + Du picks off what is measured. A second-order differential equation becomes two coupled first-order ones, one per state. The power of the form is twofold. First, the eigenvalues of A are exactly the poles of the transfer function, so stability and response read off the same matrix. Second, the first-order form ẋ = f(x, u) is precisely what a numerical integrator steps forward in time, making state space the natural language of simulation for systems of any order or number of inputs.
The skills, taught in order
Five skills build the state vector, the matrix form, the eigenvalue link to poles, and simulation.
9.1 State variables
The states are a minimal set of variables, one per independent energy store, that fully describe the system's condition. For a mass-spring-damper they are position and velocity. Knowing the states now, and the input, determines all future behaviour.
9.2 The state-space form
The model is written ẋ = Ax + Bu and y = Cx + Du. The first equation governs how the states evolve; the second selects the outputs. A second-order system has a 2 by 2 A matrix, a higher-order one a larger matrix, but the form never changes.
9.3 The state and input matrices
A converting an n-th order differential equation to state space, a common choice puts the top row as the trivial relation between a position and its velocity, and the bottom row carries the physics, the −k/m and −c/m terms. B couples the input into the states. The structure is systematic.
| Matrix | Role | Size (n states, one input/output) |
|---|---|---|
| A | state dynamics | n by n |
| B | input coupling | n by 1 |
| C | output selection | 1 by n |
| D | direct feedthrough | 1 by 1 |
The four state-space matrices and their sizes. A carries the dynamics; the others connect inputs and outputs.
9.4 Eigenvalues as poles
The eigenvalues of A, the roots of det(sI − A) = 0, are exactly the poles of the transfer function. So everything about stability and response, real versus complex, left versus right half plane, comes from the eigenvalues of one matrix.
9.5 Numerical simulation
Because ẋ = f(x, u) is first order, a numerical integrator steps it forward from the initial state. This is how systems too large or nonlinear for hand solution are studied, and it is the simulation half of system dynamics.
Engineering connection: state space is the form modern control design and estimation are built on, carried directly into Control Systems.
Worked example 1: state space of a mass-spring-damper
Write the mass-spring-damper m = 1 kg, c = 3 N·s/m, k = 2 N/m in state-space form with states position and velocity, and find the eigenvalues of A.
- ProblemWrite the state-space A matrix and find its eigenvalues for the system in Figure 1.
- Given / findm = 1, c = 3, k = 2; states x1 = position, x2 = velocity. Find A and its eigenvalues.
- AssumptionsLinear system; the two energy variables are the states.
- ModelFrom ẍ = −(k/m)x − (c/m)ẋ + F/m, take ẋ1 = x2 and ẋ2 = −(k/m)x1 − (c/m)x2.
- EquationsA = [[0, 1], [−k/m, −c/m]]det(sI − A) = 0
- SolveA = [[0, 1], [−2, −3]]. The characteristic polynomial is s2 + 3s + 2 = (s + 1)(s + 2), so the eigenvalues are −1 and −2.
- CheckThe characteristic polynomial s2 + 3s + 2 is identical to the transfer-function denominator from Module 6, confirming eigenvalues equal poles.
- ConclusionThe same overdamped system, now in matrix form, has eigenvalues −1 and −2. State space and transfer function describe one system two ways.
Worked example 2: eigenvalues of an underdamped system
A system has m = 1 kg, k = 25 N/m, and c = 2 N·s/m. Form the state matrix, find its eigenvalues, and read off the natural frequency and damping ratio.
- ProblemForm A, find its eigenvalues, and read ωn and ζ for the system in Figure 2.
- Given / findm = 1, k = 25, c = 2; states position and velocity. Find A, its eigenvalues, ωn, ζ.
- AssumptionsLinear underdamped system; energy variables as states.
- ModelA = [[0, 1], [−k/m, −c/m]]; eigenvalues from s2 + (c/m)s + (k/m) = 0; match to s2 + 2ζωns + ωn2.
- EquationsA = [[0, 1], [−25, −2]]s2 + 2s + 25 = 0ωn = √(k/m), ζ = c/(2√(k m))
- SolveThe characteristic equation is s2 + 2s + 25 = 0, giving eigenvalues −1 ± 4.90j. ωn = √25 = 5 rad/s, ζ = 2/(2√25) = 0.2.
- CheckThe imaginary part 4.90 equals ωd = ωn√(1 − ζ2) = 5√0.96 = 4.90, and the real part 1 equals ζωn = 0.2 × 5 = 1. Both match.
- ConclusionThe complex eigenvalue pair encodes ωn and ζ directly: its magnitude is ωn and its angle gives the damping. The matrix carries the full second-order behaviour.
Misconceptions and diagnostics
| Mistake | Symptom | Diagnostic question | Correction |
|---|---|---|---|
| Dependent variable as a state | Too many states, A singular | "Is each state an independent energy store?" | Choose a minimal independent set. |
| Output mixed into state equation | C terms appear in ẋ | "Which equation is ẋ = Ax + Bu?" | Keep the state and output equations separate. |
| Eigenvalues not equal to poles | Stability disagrees with the transfer function | "Did I use det(sI − A)?" | Eigenvalues of A are the poles. |
| Sign errors in A | Unstable model for a passive system | "Are −k/m and −c/m negative?" | Restoring and damping terms enter with minus signs. |
Practice ladder
Write the A matrix for a mass-spring-damper with m = 2, c = 8, k = 32 (states position, velocity).
Show answer
A = [[0, 1], [−k/m, −c/m]] = [[0, 1], [−16, −4]].
Find the eigenvalues of that A and state the damping class.
Show answer
s2 + 4s + 16 = 0, s = −2 ± 3.46j. Complex pair, so underdamped (ωn = 4, ζ = 0.5).
A state matrix is A = [[0, 1], [−9, −6]]. Find the eigenvalues and the damping class.
Show answer
s2 + 6s + 9 = (s + 3)2, repeated eigenvalue −3. Critically damped (ωn = 3, ζ = 1).
Explain why state space, not a single transfer function, is preferred for simulating a system with several inputs and outputs.
What good work looks like
State space handles multiple inputs and outputs in one compact matrix equation, exposes all internal states for simulation and estimation, and its first-order form is exactly what numerical integrators step forward, whereas a transfer function describes one input-output pair at a time.
Working with AI, and proving it yourself
Use AI as an examiner, not a solver
Portfolio task
Recast a model from an earlier module in state space, find the eigenvalues of A, and confirm they match the transfer-function poles, then simulate the response numerically.
Retrieval and spaced review
Closed notes. Answer out loud, then reveal.
1. Write the state-space form.
ẋ = Ax + Bu and y = Cx + Du.
2. What are the states?
A minimal independent set of energy variables, one per energy store.
3. What do the eigenvalues of A give?
The poles of the system, governing stability and response.
4. How does a complex eigenvalue pair encode ωn and ζ?
Its magnitude is ωn; its real part is ζωn and its imaginary part is ωd.
5. Why is state space good for simulation?
Its first-order form ẋ = f(x, u) is exactly what a numerical integrator steps forward.
Textbook mapping
This module follows Karnopp, Margolis, and Rosenberg, System Dynamics: Modeling, Simulation, and Control of Mechatronic Systems, 5th edition, whose state equations follow directly from the bond-graph models.
| Topic in this module | Where to read more |
|---|---|
| State variables and the state-space form | Karnopp, Margolis & Rosenberg, Chapter 5 |
| Eigenvalues as poles | Karnopp, Margolis & Rosenberg, Chapter 8 |
| Numerical simulation of state equations | Karnopp, Margolis & Rosenberg, Chapter 9 |
Chapter numbers refer to the 5th edition, whose bond-graph method produces the state equations directly.