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.

01

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.
0 or 1 weak itemsContinue with this module.
2 weak itemsRefresh eigenvalues in Mathematics, Module 9.
3 or more weak itemsReview the state-space basics in Mathematics, Module 11.
02

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 = poles

State-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 skill works when: you choose the energy variables as states and assemble A so its eigenvalues match the poles.
The skill breaks down when: a dependent variable is chosen as a state, or the output equation is confused with the state equation.
The concept. The state equation evolves the energy variables; the output equation reads off the measurement. The eigenvalues of A are the poles, tying the matrix model to everything learned about response.
03

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.

MatrixRoleSize (n states, one input/output)
Astate dynamicsn by n
Binput couplingn by 1
Coutput selection1 by n
Ddirect feedthrough1 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.

04

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.

Figure 1. The top row of A relates position to velocity; the bottom row carries the physics. Its eigenvalues, −1 and −2, are exactly the transfer-function poles found earlier.
  1. ProblemWrite the state-space A matrix and find its eigenvalues for the system in Figure 1.
  2. Given / findm = 1, c = 3, k = 2; states x1 = position, x2 = velocity. Find A and its eigenvalues.
  3. AssumptionsLinear system; the two energy variables are the states.
  4. ModelFrom ẍ = −(k/m)x − (c/m)ẋ + F/m, take ẋ1 = x2 and ẋ2 = −(k/m)x1 − (c/m)x2.
  5. EquationsA = [[0, 1], [−k/m, −c/m]]det(sI − A) = 0
  6. SolveA = [[0, 1], [−2, −3]]. The characteristic polynomial is s2 + 3s + 2 = (s + 1)(s + 2), so the eigenvalues are −1 and −2.
  7. CheckThe characteristic polynomial s2 + 3s + 2 is identical to the transfer-function denominator from Module 6, confirming eigenvalues equal poles.
  8. ConclusionThe same overdamped system, now in matrix form, has eigenvalues −1 and −2. State space and transfer function describe one system two ways.
Result. A = [[0, 1], [−2, −3]], eigenvalues −1 and −2.
05

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.

Figure 2. The eigenvalues form a complex conjugate pair in the left half plane. Their real part is the decay rate ζωn, their imaginary part the damped frequency ωd.
  1. ProblemForm A, find its eigenvalues, and read ωn and ζ for the system in Figure 2.
  2. Given / findm = 1, k = 25, c = 2; states position and velocity. Find A, its eigenvalues, ωn, ζ.
  3. AssumptionsLinear underdamped system; energy variables as states.
  4. ModelA = [[0, 1], [−k/m, −c/m]]; eigenvalues from s2 + (c/m)s + (k/m) = 0; match to s2 + 2ζωns + ωn2.
  5. EquationsA = [[0, 1], [−25, −2]]s2 + 2s + 25 = 0ωn = √(k/m), ζ = c/(2√(k m))
  6. SolveThe characteristic equation is s2 + 2s + 25 = 0, giving eigenvalues −1 ± 4.90j. ωn = √25 = 5 rad/s, ζ = 2/(2√25) = 0.2.
  7. 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.
  8. 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.
Result. Eigenvalues −1 ± 4.90j; ωn = 5 rad/s, ζ = 0.2.
06

Misconceptions and diagnostics

MistakeSymptomDiagnostic questionCorrection
Dependent variable as a stateToo many states, A singular"Is each state an independent energy store?"Choose a minimal independent set.
Output mixed into state equationC terms appear in ẋ"Which equation is ẋ = Ax + Bu?"Keep the state and output equations separate.
Eigenvalues not equal to polesStability disagrees with the transfer function"Did I use det(sI − A)?"Eigenvalues of A are the poles.
Sign errors in AUnstable model for a passive system"Are −k/m and −c/m negative?"Restoring and damping terms enter with minus signs.
07

Practice ladder

Level 1 · Direct skill

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

Level 2 · Mixed concept

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

Level 3 · Independent problem

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

Transfer task | Real engineering

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.

08

Working with AI, and proving it yourself

Use AI as an examiner, not a solver

"Check that my states are independent energy variables."
"Give me three A matrices; I will find the eigenvalues and damping of each."
"Build the state-space model for me." Choosing the states and assembling A is the skill.
"Are the eigenvalues the poles?" Computing det(sI − A) yourself is the point.

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.

Must include: the state vector, the A matrix, its eigenvalues, and a pole comparison.
09

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.

TodayFinish this quiz and Levels 1 and 2 of the ladder.
+1 dayRe-derive A and its eigenvalues for a mass-spring-damper.
+3 daysFind the eigenvalues of three new state matrices.
+7 daysRead the same system in the frequency domain, Module 10.
+30 daysCarry state space into modern control design.
10

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 moduleWhere to read more
State variables and the state-space formKarnopp, Margolis & Rosenberg, Chapter 5
Eigenvalues as polesKarnopp, Margolis & Rosenberg, Chapter 8
Numerical simulation of state equationsKarnopp, Margolis & Rosenberg, Chapter 9

Chapter numbers refer to the 5th edition, whose bond-graph method produces the state equations directly.