Skip to the lesson
FixTheRobot Explore Robotics / Guidance, Navigation and Control / M4 State-Space and Optimal Control / M4-T1

Guidance, Navigation and Control · Theory · M4

M4-T1 — State-Space Models, Modes and Stability

A transfer function describes one input and one output. A state-space model describes everything inside, and its eigenvectors say which states move together.

  • Lesson 1 of 6
  • Intermediate
  • Module 4: State-Space and Optimal Control
  • Theory
  • About 16 minutes to read

Module 3 designed one loop on one pitch angle. Hopper is not one loop. Its position, velocity, pitch and pitch rate are tied together, and the gimbal that steers one steers all four. State-space models are the language for that. They write the whole vehicle as one first-order matrix equation, and the eigenvalues and eigenvectors of its matrix are the vehicle's natural motions. This lesson sets the language up on Hopper's lateral channel and answers a first question with it: when the unstable pitch axis diverges, what does the rest of the vehicle do?

Learning objectives

After this lesson, you should be able to:

  • Write a linear vehicle model in the form ẋ = Ax + Bu, y = Cx + Du.
  • Compute the modes of a model (eigenvalue and eigenvector) and say what each describes physically.
  • Relate the eigenvalues of A to the poles of a transfer function, and say how the zeros depend on the output.
  • Recognise a repeated eigenvalue with a single eigenvector and its consequence.

The intuition

M2-T4: Trim and Linearization linearized Hopper's lateral channel into four states, the position xx, velocity vxv_x, pitch θ\theta and pitch rate qq, with the gimbal angle δ\delta as the input. Written as a matrix equation it is the following.

x˙=Ax+B δ\dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}\,\delta with A\mathbf{A} having the entries 1, gg, 1 and λ2\lambda^2 and B=(0,g,0,b)T\mathbf{B} = (0, g, 0, b)^{\mathsf{T}}. The first two rows say that velocity is the rate of change of position and that tilting the thrust accelerates the vehicle sideways. The last two say that pitch rate is the rate of change of pitch and that the pitch moment has a destabilizing term and a gimbal term.

Module 3's tools read one input and one output. A state-space model keeps all four states and lets you ask what the transfer-function view hides.

Modes: motions that keep their shape

Release the vehicle with the gimbal fixed and look at what it does. In general the four states move in a tangle. But there are special starting points from which the motion is simple: all four states change by the same exponential, eλte^{\lambda t}, in fixed proportions. Such a motion is a mode. The exponent λ\lambda is an eigenvalue of A\mathbf{A} and the proportions are its eigenvector. Any motion is a sum of modes.

The eigenvalues are the poles of module 3, and they come out the same: 0, 0, −0.7 and +0.7. The eigenvector adds something the transfer function does not show: what moves with what. For the divergent mode, with the pitch normalized to 1, the position is 20.0, the velocity 14.0 and the pitch rate 0.7. A pitch error of 0.01 rad that diverges drags the velocity along at 0.14 m/s and the position at 0.20 m, and all of them grow at the same rate. The figure shows the four states after such an error, on a logarithmic scale. After the first second they are parallel lines: one mode is in charge.

The four states of the lateral channel after a small pitch error, on a logarithmic scaleFour nearly parallel straight lines rising on a logarithmic vertical axis against time from 0 to 8 seconds, for position, velocity, pitch and pitch rate after a pitch error of 0.01 radians. After the first second they all rise at the same slope, 0.7 times log10 of e per second, because one mode, the divergent one, dominates. They are separated by fixed factors: position is about 20 times pitch, velocity about 14 times pitch, and pitch rate 0.7 times pitch.012345678-3.5-2.5-1.5-0.50.51.5time (s)log10 of the magnitude position velocity pitch pitch rate
The four states of the lateral channel after a 0.01 rad pitch error, on a logarithmic scale. Parallel lines mean one mode: they grow together, in fixed ratios.

The practical lesson is about the order of a design. The vehicle's position cannot be controlled without first controlling the divergent mode, because any pitch error carries a position error with it. Control design for the lateral channel starts from the pitch.

Poles are shared, zeros depend on the output

The same A\mathbf{A} gives different transfer functions for different outputs. The transfer function from the gimbal to the pitch has no finite zero. The one to the position has two zeros at ±4.37j\pm 4.37j: they appear because the gimbal moves the position by two routes, through the pitch it creates and directly, by tilting the thrust, and at one frequency the two cancel. Poles belong to the vehicle. Zeros belong to the choice of what is measured or controlled.

A repeated eigenvalue with one eigenvector

The double eigenvalue at zero is the position and velocity pair, a double integrator. A matrix of this kind has fewer eigenvectors than eigenvalues, and then the motion contains a term growing like tt. Left alone, with a velocity of 1 m/s, the position grows linearly, and no exponential describes it. The mode picture still holds, with this extension.

A model with one input and one output tells you how the output responds to the input. A state-space model also tells you which states move together, and that is what a multivariable design needs.

Definitions

State x\mathbf{x}, input uu, output yy
The state is a vector that, with the input, determines the future: for Hopper's lateral channel (x,vx,θ,q)(x, v_x, \theta, q). The output yy is what is measured or controlled.
System matrices
A\mathbf{A} (how the state changes by itself), B\mathbf{B} (how the input drives it), C\mathbf{C} (what is read out) and DD (direct feed from input to output, usually 0).
Eigenvalue and eigenvector
λ\lambda and v\mathbf{v} with Av=λv\mathbf{A}\mathbf{v} = \lambda\mathbf{v}. A left eigenvector w\mathbf{w} satisfies wTA=λwT\mathbf{w}^{\mathsf{T}}\mathbf{A} = \lambda\mathbf{w}^{\mathsf{T}}.
Mode
The motion v eλt\mathbf{v}\,e^{\lambda t}: every state moves by the same exponential, in the proportions of the eigenvector.

The model, with its output equation:

A linear state-space model
x˙=Ax+Bu,y=Cx+D u\dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}u, \qquad y = \mathbf{C}\mathbf{x} + D\,u
For Hopper, A\mathbf{A} and B\mathbf{B} are those of M2-T4: Trim and Linearization. Choosing C=(1,0,0,0)\mathbf{C} = (1, 0, 0, 0) outputs the position, (0,0,1,0)(0, 0, 1, 0) the pitch.

With no input, a motion is a sum of modes. When A\mathbf{A} has a full set of eigenvectors vi\mathbf{v}_i, the coefficient of each is found from a left eigenvector wi\mathbf{w}_i:

Modal decomposition
x(t)=∑ici vi eλit,ci=wiTx(0)wiTvi\mathbf{x}(t) = \sum_i c_i\,\mathbf{v}_i\,e^{\lambda_i t}, \qquad c_i = \frac{\mathbf{w}_i^{\mathsf{T}}\mathbf{x}(0)}{\mathbf{w}_i^{\mathsf{T}}\mathbf{v}_i}
The left eigenvector measures how much of the initial state lies in each mode.

The transfer function of the model, whose denominator is the characteristic polynomial of A\mathbf{A}:

From state space to transfer function
G(s)=C (sI−A)−1B+D=C adj⁡(sI−A) B+D det⁡(sI−A)det⁡(sI−A)G(s) = \mathbf{C}\,(s\mathbf{I} - \mathbf{A})^{-1}\mathbf{B} + D = \frac{\mathbf{C}\,\operatorname{adj}(s\mathbf{I} - \mathbf{A})\,\mathbf{B} + D\,\det(s\mathbf{I} - \mathbf{A})}{\det(s\mathbf{I} - \mathbf{A})}
The poles are among the eigenvalues of A. The numerator, and so the zeros, depends on C, B and D.

Derivation: modes, the transfer function, and Hopper's divergent mode

All three ideas follow from substituting an exponential.

  1. x(t)=v eλt  ⇒  λ v eλt=A v eλt\mathbf{x}(t) = \mathbf{v}\,e^{\lambda t} \;\Rightarrow\; \lambda\,\mathbf{v}\,e^{\lambda t} = \mathbf{A}\,\mathbf{v}\,e^{\lambda t}

    Look for a motion with no input in which every state has the same exponential time dependence. Substitute it in x˙=Ax\dot{\mathbf{x}} = \mathbf{A}\mathbf{x}.

  2. (A−λI) v=0(\mathbf{A} - \lambda\mathbf{I})\,\mathbf{v} = 0

    Cancel the exponential. A nonzero v\mathbf{v} exists only if det⁡(A−λI)=0\det(\mathbf{A} - \lambda\mathbf{I}) = 0, so λ\lambda is an eigenvalue and v\mathbf{v} its eigenvector.

  3. x(0)=∑icivi  ⇒  x(t)=∑icivi eλit\mathbf{x}(0) = \sum_i c_i\mathbf{v}_i \;\Rightarrow\; \mathbf{x}(t) = \sum_i c_i\mathbf{v}_i\,e^{\lambda_i t}

    The equation is linear, so a sum of solutions is a solution. If the eigenvectors span the space, any initial state is a sum of them, and its motion is the same sum of modes.

  4. sX(s)=AX(s)+BU(s)  ⇒  X=(sI−A)−1B Us\mathbf{X}(s) = \mathbf{A}\mathbf{X}(s) + \mathbf{B}U(s) \;\Rightarrow\; \mathbf{X} = (s\mathbf{I} - \mathbf{A})^{-1}\mathbf{B}\,U

    Take the Laplace transform of the state equation, with zero initial state, and solve for the state. The output CX+DU\mathbf{C}\mathbf{X} + DU gives the transfer function.

  5. (sI−A)−1=adj⁡(sI−A)det⁡(sI−A)(s\mathbf{I} - \mathbf{A})^{-1} = \frac{\operatorname{adj}(s\mathbf{I} - \mathbf{A})}{\det(s\mathbf{I} - \mathbf{A})}

    The inverse of a matrix is its adjugate over its determinant, so every pole of GG is a root of the characteristic polynomial. A root can fail to appear as a pole when the numerator cancels it: that is a mode that the input cannot excite or the output cannot see (the next lesson).

Hopper's divergent mode, by hand

  1. v=(v1,v2,1,v4):λ v4=λ2⋅1  ⇒  v4=λ\mathbf{v} = (v_1, v_2, 1, v_4):\quad \lambda\,v_4 = \lambda^2\cdot 1 \;\Rightarrow\; v_4 = \lambda

    Normalize the pitch component to 1. The fourth row of Av=λv\mathbf{A}\mathbf{v} = \lambda\mathbf{v} reads λ2⋅1=λv4\lambda^2\cdot 1 = \lambda v_4, and the third row v4=λ⋅1v_4 = \lambda\cdot 1. Both give v4=λv_4 = \lambda.

  2. g⋅1=λ v2  ⇒  v2=gλ,v2=λ v1  ⇒  v1=gλ2g\cdot 1 = \lambda\,v_2 \;\Rightarrow\; v_2 = \frac{g}{\lambda}, \qquad v_2 = \lambda\,v_1 \;\Rightarrow\; v_1 = \frac{g}{\lambda^2}

    The second row says that tilting accelerates the vehicle, and the first that velocity is the rate of change of position. They fix the velocity and the position in the mode.

  3. v±=(gλ2, ±gλ, 1, ±λ)=(20.02, ±14.01, 1, ±0.7)\mathbf{v}_{\pm} = \left(\frac{g}{\lambda^2},\ \pm\frac{g}{\lambda},\ 1,\ \pm\lambda\right) = (20.02,\ \pm 14.01,\ 1,\ \pm 0.7)

    Both signs of λ=±0.7\lambda = \pm 0.7 work. The plus sign is the divergent mode, the minus sign its decaying twin.

The eigenvalues of A are the poles. The eigenvectors say how the states share each mode, and the zeros come from what is measured. The same vehicle has one set of poles and many sets of zeros.

A worked example

Take Hopper's lateral model with g=9.81g = 9.81, λ=0.7\lambda = 0.7 and b=19.62b = 19.62 and examine it.

  1. Eigenvalues. The matrix has eigenvalues 0, 0, −0.7 and +0.7: the position-velocity integrators and the pitch pair.
  2. The pitch modes. The vectors (g/λ2,±g/λ,1,±λ)(g/\lambda^2, \pm g/\lambda, 1, \pm\lambda) satisfy Av=λv\mathbf{A}\mathbf{v} = \lambda\mathbf{v} to 2×10⁻¹⁵: (20.02, 14.01, 1, 0.7) for the divergent mode and (20.02, −14.01, 1, −0.7) for the convergent one.
  3. The Jordan pair. The matrix has rank 3, so the double eigenvalue at 0 has a single eigenvector: position and velocity form a Jordan block.
  4. Transfer functions. From the gimbal to the pitch the numerator is 19.6219.62 (no finite zero). To the position it is 9.81 s2+187.679.81\,s^2 + 187.67, with zeros at ±4.37j\pm 4.37j: the pitch route and the direct route cancel at s2=λ2−bs^2 = \lambda^2 - b. The same four poles in both.
  5. Check the mode picture. Start with a 0.01 rad pitch error, with all else zero, and propagate it 8 s with the matrix exponential. The state is (26.87 m, 18.95 m/s, 1.352 rad, 0.946 rad/s). The divergent mode alone, with its coefficient found from the left eigenvector, gives (27.07, 18.95, 1.352, 0.946). The other three modes contribute under 1% of the position and nothing to the others.
import math
import gnckit as g

gr, lam, b = 9.81, 0.7, 19.62
A = [[0, 1, 0, 0], [0, 0, gr, 0], [0, 0, 0, 1], [0, 0, lam ** 2, 0]]     # states: position, velocity, pitch, pitch rate
B = [0, gr, 0, b]
print('eigenvalues of A:', [round(complex(p).real, 3) for p in g.mat_eigvals(A)])

for sign in (+1, -1):
    mu = sign * lam
    v = [gr / mu ** 2, gr / mu, 1.0, mu]                                   # the mode: pitch 1, rate mu, velocity g/mu, position g/mu^2
    res = max(abs(a - mu * c) for a, c in zip(g.mat_vec(A, v), v))
    print(f'mode for lambda = {mu:+.1f}: v = {[round(c, 2) for c in v]}, |A v - lambda v| = {res:.0e}')
print('rank of A =', g.mat_rank(A), 'so the double eigenvalue at 0 has a single eigenvector: position and velocity form a Jordan block')

for name, C in (('position', [1, 0, 0, 0]), ('pitch', [0, 0, 1, 0])):
    tf = g.ss_to_tf(A, B, C)
    print(f'gimbal to {name}: numerator {[round(c, 2) for c in tf.num]}, zeros {[complex(round(z.real, 2), round(z.imag, 2)) for z in tf.zeros()]}')

# a 0.01 rad pitch error: how much of the state at t = 8 s is the divergent mode?
x0 = [0.0, 0.0, 0.01, 0.0]
E = g.mat_expm(A, 8.0)
x8 = g.mat_vec(E, x0)
vp = g.eigvec(A, lam)
wl = g.left_eigvec(A, lam)
coef = sum(w * x for w, x in zip(wl, x0)) / sum(w * v for w, v in zip(wl, vp))
mode = [coef * v * math.exp(lam * 8.0) for v in vp]
print('state at 8 s (position, velocity, pitch, rate):', [round(c, 3) for c in x8])
print('divergent mode alone                         :', [round(c, 3) for c in mode])
eigenvalues of A: [0.0, 0.0, -0.7, 0.7]
mode for lambda = +0.7: v = [20.02, 14.01, 1.0, 0.7], |A v - lambda v| = 2e-15
mode for lambda = -0.7: v = [20.02, -14.01, 1.0, -0.7], |A v - lambda v| = 2e-15
rank of A = 3 so the double eigenvalue at 0 has a single eigenvector: position and velocity form a Jordan block
gimbal to position: numerator [9.81, 0.0, 187.67], zeros [(-0-4.37j), 4.37j]
gimbal to pitch: numerator [19.62, 0.0, 0.0], zeros [0j, 0j]
state at 8 s (position, velocity, pitch, rate): [26.87, 18.949, 1.352, 0.946]
divergent mode alone                         : [27.07, 18.949, 1.352, 0.946]
eigvec and left_eigvec find the eigenvectors of a matrix with a real eigenvalue; mat_expm is the matrix exponential.

In robotics

Modes are how vehicle dynamics are read in every field.

  • Aircraft modes. The short-period, phugoid, roll, spiral and Dutch-roll motions of module 10 are modes of a state-space model, and their eigenvectors say which states take part: the short period is mostly angle of attack and pitch rate, the phugoid mostly airspeed and pitch angle. Flight-test engineers identify them from the eigenvectors.
  • Flexible structures. A rocket's bending modes and a satellite's solar-array modes are eigenvectors of the structural model: the shape in which the structure vibrates. The bending mode seen by the gyroscope is the one the notch filter of M3-T7: Digital Control: Sampling, Delay and Anti-Windup removes.
  • Unstable airframes. The eigenvector of the divergent mode of a relaxed-stability aircraft says which sensors see the divergence first, and so where a feedback loop should take its measurement.
  • Tools. Eigenvalues and eigenvectors come from numpy.linalg.eig or, for a few states, from gnckit.mat_eigvals and eigvec. The linear algebra is the subject of Linear Algebra M6-T1: Eigenvalues and Eigenvectors. The rigid-body model that the UAV track writes out in UAV M1-T5: Six-degree-of-freedom UAV dynamics is linearized to such a model in the same way as here.

The next lesson asks the two questions that matter before designing anything: can the input reach every mode (controllability), and can the sensors see every mode (observability).

Common misconceptions

“The states of a model are unique.”

Any invertible change of variables z=Tx\mathbf{z} = \mathbf{T}\mathbf{x} gives another valid state vector with matrices TAT−1\mathbf{T}\mathbf{A}\mathbf{T}^{-1} and so on, with the same eigenvalues and the same transfer function. Position, velocity, pitch and rate are a convenient choice, not the only one. The modal coordinates are another.

“A transfer function holds all the information in a state-space model.”

It holds only the part that is both reachable from the input and visible at the output. A mode that cancels in the transfer function is still in the vehicle and can still diverge. Hopper's state model has four modes and the transfer function to the position shows four poles, but a different choice of output can hide some.

“A zero eigenvalue is neutral and harmless.”

A double eigenvalue at zero with a single eigenvector gives a response that grows linearly, and a single zero gives a state that never returns. Hopper's position drifts for ever after any velocity error. Neutral is not the same as safe.

“Eigenvectors point along physical axes.”

They are directions in the space of states, mixing quantities with different units: position, velocity, angle. Only the ratios matter and they carry units (20 m per radian, 14 m/s per radian). Scaling the states changes the numbers, not the mode.

“The zeros are a property of the plant.”

They depend on which output you look at. The same Hopper has no zero from gimbal to pitch and a pair at ±4.37j from gimbal to position. Choosing what to control is also choosing the zeros.

Key takeaways

  1. A linear vehicle model is x˙=Ax+Bu\dot{\mathbf{x}} = \mathbf{A}\mathbf{x} + \mathbf{B}u, y=Cx+Duy = \mathbf{C}\mathbf{x} + Du; the same A\mathbf{A} serves every choice of output.
  2. A mode is a motion veλt\mathbf{v}e^{\lambda t} in which all states move together; the eigenvalue is its exponent and the eigenvector its shape.
  3. Every free motion is a sum of modes, with coefficients given by the left eigenvectors.
  4. Hopper's divergent mode has the shape (g/λ2,g/λ,1,λ)(g/\lambda^2, g/\lambda, 1, \lambda): a pitch error carries a position and a velocity error with it.
  5. The poles of the transfer function are eigenvalues of A\mathbf{A}; the zeros depend on C\mathbf{C} and B\mathbf{B}.
  6. A repeated eigenvalue with one eigenvector gives a response that grows like tt.

References and further reading

Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.

Knowledge check

Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

A pitch error of 0.02 rad (and nothing else) is released at t = 0 with the gimbal held fixed. Using the exact solution θ = θ₀ cosh λt, v = (gθ₀/λ) sinh λt, x = (gθ₀/λ²)(cosh λt − 1), what are the pitch, the lateral velocity and the position after 5 s?

Explanation

With λt = 3.5, cosh 3.5 = 16.57 and sinh 3.5 = 16.54. The pitch is 0.02 × 16.57 = 0.331 rad (19°), the velocity is (9.81 × 0.02 / 0.7) × 16.54 = 4.64 m/s, and the position is (9.81 × 0.02 / 0.49) × (16.57 − 1) = 6.24 m. The pitch error has multiplied by 17 and brought a 6 m position error with it. The proportions of the divergent mode, 20 m per radian of pitch for position and 14 m/s per radian for velocity, appear once the exponential dominates.

Question 2

Hopper's lateral A has a double eigenvalue at 0 but only one eigenvector. What does that say about the response of the position to an initial velocity of 2 m/s, with the pitch kept at zero?

Explanation

With one eigenvector for the double zero eigenvalue there is no pure mode that carries a velocity: the response contains a term that grows like t. With the pitch held at zero the position obeys ẍ = 0, so x(t) = 2t: it grows linearly and never settles. A matrix with a full set of eigenvectors (distinct eigenvalues) has only exponentials, so a double eigenvalue at 0 with one eigenvector is a sign of an integrator chain, and of a vehicle that drifts.

Question 3

Why does the transfer function from the gimbal to Hopper's position have zeros at ±4.37j while the one to the pitch has none, although both come from the same A and B?

Explanation

The zeros come from the output matrix and the way the input enters. The gimbal affects the position by two routes: directly, because tilting the thrust gives a sideways force g δ, and through the pitch it creates, which then accelerates the vehicle sideways. At s² = λ² − b = −19.1 the contributions of the two routes cancel, giving zeros at ±j4.37. The pitch has only one route from the gimbal, so it has no zero. The poles come from A alone and are the same for both outputs.

What’s next

Next lesson

M4-T2 — Controllability, Observability and Pole Placement

Test whether a model can be controlled and observed, and place the closed-loop poles of a controllable model by state feedback.

Nothing below is required to finish this lesson.

Other courses on this site treat neighbouring topics from their own angle:

This course leaves the following to the pages that already teach them: