Controllability
A state-space model ẋ = Ax + Bu, y = Cx raises two questions. Can the input u steer every state wherever we like? That is controllability. Can the output y reveal every state? That is observability. Start with the cart.
B = [0, 0.5] says the force acts only on the velocity x₂, at 0.5 m/s² per newton. There is no wire from u to the position x₁: that entry of B is zero. Is the position out of reach?
No. Row one of A says ẋ₁ = x₂: velocity flows into position, so the push reaches x₁ one integration later. Multiplying shows it: AB = [0.5, −1]. Its first entry is no longer zero.
Put the two directions side by side: [B AB] = [[0, 0.5], [0.5, −1]]. Its determinant is −0.25, not zero, so the columns point different ways and span the plane. Rank 2 equals the number of states: controllable.
Controllable means we can solve for an input. Goal: from rest to 0.1 m, stopped, in 1 s. Two unknowns, two equations: push 2.17 N for half a second, then 4.20 N. It lands exactly, and 5 N holds it.
When it fails
Now a system that fails. Two identical tanks each head for the pump setting u with a 1-minute time constant: ẋ₁ = −x₁ + u, ẋ₂ = −x₂ + u. One pump feeds both, so B = [1, 1]. Every state has a wire.
Start tank 1 at 1 m and tank 2 empty, then run the pump. Subtract the equations: the gap x₁ − x₂ obeys d(gap)/dt = −gap. It fades as e^(−t) whatever u does. No input can hold the levels apart.
AB = [−1, −1] lies along the same line as B = [1, 1]. So [B AB] = [[1, −1], [1, −1]] has determinant 0 and rank 1. The pump moves only the average level. A wire to every state is not enough.
Observability
Now the mirror question. The cart's sensor reads position only: C = [1, 0]. Velocity is how fast that reading changes: CA = [0, 1]. Stacked, [C; CA] is the identity: determinant 1, rank 2. The cart is observable.
Read the tanks with one sensor for the total level, C = [1, 1], pump off. Start A at [1, 0] and start B at [0, 1] give the same output, e^(−t), for ever. [C; CA] = [[1, 1], [−1, −1]]: rank 1, unobservable.
State feedback can move every pole only if the system is controllable; an observer can place its error poles only if it is observable. The tanks hide a mode: their transfer function is just 2/(s + 1). Check the ranks first.
What is happening
# step 1/11 · question
# about: State x₁, State x₂, Input u, Output y
the cart from "State-space models"
2 kg, spring 50 N/m, damper 4 N·s/m
x = [x₁, x₂] = [position, velocity]
u = force (N) y = position (m)
A = [[ 0, 1], B = [0, 0.5]ᵀ
[-25, -2]] C = [1, 0]
controllable u can drive x anywhere
observable y lets us work out x
The cart is the 2 kg, 50 N/m, 4 N·s/m cart of the earlier lessons; the tanks are an illustrative pair with a 1-minute time constant. Every curve and number in the figure is computed from these state equations. The Python on each step is plain Python 3. It steps the equations forward with small time steps, so its last digits differ slightly from the exact values the figure plots.