Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 37 · State Space

Controllability and Observability

Learn controllability and observability: rank tests, hidden modes and pole-zero cancellation, Gramians as a measure of how hard a state is to reach, with NumPy code.

Before you design a state controller or an estimator, you need two answers. Can the input steer the state wherever you want? Can the output tell you what the state is? These are the questions of controllability and observability, introduced by Kalman in 1960. They decide whether pole placement, LQR and observers are possible at all, and they explain a subtle failure of transfer functions: a system can have an unstable mode that never shows up in G(s).

Definitions

For x' = Ax + Bu, y = Cx, with n states:

  • The system is controllable if for any initial and target states there is an input that moves the state from one to the other in finite time.
  • The system is observable if the initial state can be determined from the output (and input) over a finite time.

Both have simple rank tests.

TEXT
Controllability matrix:  Co = [B  AB  A²B  ...  A^(n-1)B]     controllable  <=>  rank(Co) = n
Observability matrix:    Ob = [C; CA; CA²; ...; CA^(n-1)]     observable    <=>  rank(Ob) = n

The two are duals: (A, B) is controllable exactly when (Aᵀ, Bᵀ) is observable. That duality is why an observer design (next lessons) is the mirror image of a state-feedback design.

flowchart LR
    U["input u"] -->|"controllable?"| X["state x"]
    X -->|"observable?"| Y["output y"]

Controllability concerns the path from input to state; observability concerns the path from state to output.

Rank tests in code

We check three systems: the damped mass-spring from the last lesson, two decoupled lags where the input only drives the first one, and two identical lags that are fed and measured symmetrically.

Python Controllability and observability ranks

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The mass-spring is both controllable and observable (rank 2). In the second system the input cannot reach the second lag: it is uncontrollable, though observable. In the third the two identical lags cannot be distinguished: the input excites both identically, so the system is neither fully controllable nor observable.

Hidden modes and pole-zero cancellation

An uncontrollable or unobservable mode does not appear in the transfer function: it cancels. The second system has two states, with poles -1 and -2, but the input only drives the first; its transfer function has a single pole. A numerical cancellation exposes that.

Python The transfer function hides the uncontrollable mode

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This is harmless when the hidden mode is stable, like -2 here. It is a hazard when it is unstable: a controller designed from the transfer function sees a stable plant, yet the hidden state diverges and the physical system fails. Never cancel an unstable pole with a controller zero, because the cancelled mode remains, uncontrollably.

A model that is stabilizable (all uncontrollable modes are stable) can still be stabilized by feedback; one that is detectable (all unobservable modes are stable) can still be estimated. Controllability and observability are sufficient, stabilizability and detectability are the minimum.

How controllable? The Gramian

Rank is a yes/no answer. In practice, "controllable but needs 10,000 times more energy in one direction" is almost the same as uncontrollable. The controllability Gramian Wc quantifies it. For a stable system, Wc solves the Lyapunov equation A·Wc + Wc·Aᵀ = -B·Bᵀ, and the minimum input energy to reach state x_f from rest is x_fᵀ Wc⁻¹ x_f. Directions where Wc has small eigenvalues are expensive to reach. (The observability Gramian plays the same role for estimation.)

Python Gramian: which direction is expensive?

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The velocity direction is cheaper (energy 4) than the position direction (energy 20): the force pushes the mass directly, while position has to be built up through velocity. A large condition number is a warning that a design will need big, fast inputs for some states.

Physical meaning, quick examples

  • Cart and inverted pendulum, input = force on cart: controllable (all four states, thanks to coupling), observable if you measure cart position and angle.
  • Two thermal masses in a row, heater on the first, sensor on the second: controllable and observable, but with slow, weak coupling, so the Gramians are small.
  • Two identical motors driven by the same voltage, measuring total speed: neither controllable nor observable in the difference mode.
  • A tank with an outlet valve you cannot move: the level is controllable but the valve position state is not part of the model.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. A system with n states is controllable when:

    The Kalman rank condition on the controllability matrix is the test; stability is a separate property.
  2. 2. What is the dual of the controllability test for (A, B)?

    (A, B) is controllable exactly when (A^T, B^T), with B^T playing the role of C, is observable.
  3. 3. A transfer function G(s) has one pole but the state model has two states. What does this suggest?

    Hidden modes cancel out in the transfer function; the state-space model keeps them.
  4. 4. Why is cancelling an unstable pole with a controller zero dangerous?

    Cancellation removes the pole from the input-output map only; the internal mode remains and diverges.

Summary

  • Controllability: can the input reach any state? Observability: can the output reveal any state?
  • Both are rank tests on [B AB ...] and [C; CA; ...]; they are dual.
  • Uncontrollable or unobservable modes cancel in the transfer function, which is dangerous if unstable.
  • Gramians measure how controllable or observable, not just whether.
  • You need controllability for pole placement and observability for observers.

Next: State Feedback and Pole Placement