13.6 State-Space Control & Pole Placement placed poles by decree and found the bill: the cruise command grew like , and the aircraft asked for rad of rudder. It also assumed every state could be read off a dial. LQR writes the bill into a cost function, so the compromise between error and effort becomes a number we choose. An observer rebuilds the unmeasured states from the one signal we do measure. Together they close Module 13.
Transcript
- LQR writes the bill into a cost. Score the whole trajectory: J is the integral of x transpose Q x plus u transpose R u. Q weighs the state error and R weighs the control. A designer who cares only about speed uses Q equal diag q, 0, and J becomes the integral of q y squared plus r u squared. Doubling both weights changes nothing about which trajectory is best, so only the ratio q over r matters: one knob, where pole placement had two.
- Suppose the best cost from x is x transpose P x. Setting the derivative in u to zero gives u equal minus K x, with K equal R inverse B transpose P: linear state feedback. P solves the algebraic Riccati equation. Kleinman's iteration, from memory, starts at K equal 0, solves a linear Lyapunov equation for P, sets K, and repeats: 9 passes for the default design. A scalar plant by hand: a equal minus 1, q equal 3, r equal 1 gives K equal 1 and a pole at minus 2. For the cruise plant with q equal 1 and r equal 0.01, K is 8.4121 and 0.6378, poles minus 0.8689 plus or minus 0.5000 i, N equal 10.0499, with 0.43 percent overshoot, settling in 4.345 seconds.
- Sweep the ratio q over r, with r equal 1. At q over r equal 1 the poles barely leave minus 0.1 and minus 1: effort is spent only when it buys something. At 100 they are minus 0.8689 plus or minus 0.5000 i, at 10 to the 4 minus 2.2919 plus or minus 2.1789 i, and at 10 to the 6 minus 7.0889 plus or minus 7.0532 i. The damping settles toward 0.7: 0.7247, then 0.7089, the Butterworth pattern, from memory. The opening command N equals the square root of 1 plus q over r. LQR does not remove the cost of speed; it makes the exchange rate a single dial.
- The ratio law comes from an identity: the magnitude of 1 plus L, squared, equals 1 plus q over r times G squared, so it is at least 1 at every frequency. At crossover it equals 2 sin of PM over 2, so the phase margin is at least 60 degrees; the gain margin is one half to infinity, from memory. The lab gives a minimum of 1.0000, phase margin 87.82 degrees at 0.804 radians per second, and 70.42 degrees at 4.113 for q over r equal 10 to the 4. Full-state only: an observer loses it, Doyle's counterexample, from memory. Bryson's rule, from memory: error 1, throttle 10 gives q equal 1, r equal 0.01.
- The car has a speed sensor and no engine dial. An observer runs a copy of the plant, drives it with the same input, and corrects it by the output it gets wrong. The error then obeys e dot equals A minus L C times e. Place those poles with the dual of Ackermann, if the observability matrix has full rank: for the cruise plant its determinant is 0.1. A rule of thumb, from memory: 2 to 5 times faster than the controller's 1.0025: at m equal 3, L is 3.1105 and 58.3443, poles minus 2.1052 plus or minus 2.1478 i. Started wrong, the estimate chases the true engine state.
- Close the loop on the estimate: u equals minus K x hat plus N r. In x and e coordinates the matrix is block triangular, so the poles of the combined system are those of A minus B K together with those of A minus L C: minus 2.1052 plus or minus 2.1478 i and minus 0.8689 plus or minus 0.5000 i. That is separation. If e starts at 0 the response is the full-state one: 0.43 percent, 4.345 seconds. But separation fixes poles, not the transient. With the estimate off by 1 and 1, the step has 0.92 percent overshoot, settles in 3.495 seconds, peaks at 12.0693 rather than 10.0499, and the error in a peaks at 8.4183.
- A faster observer buys little. Sweeping m, peak command goes 4.8577, 8.7364, 12.0693, 18.2700 and 33.1726 for m equal 1, 2, 3, 5 and 10, while settling barely improves beyond 3: 3.495, 3.430, 3.380 seconds. With sensor noise of 0.05 the rms command jitter is 0.0916, 0.0939, 0.1737, 0.3552 and 0.9188. Without noise the jitter at m equal 5 and 10 is only 0.0054 and 0.0066, so the growth is all noise. A slow observer ignores noise but reacts late; a fast one shakes.
- The Kalman filter settles the trade-off, and it is the LQR problem in disguise: the same Riccati equation with A transpose and C transpose, and L equal P C transpose over V. At sigma 0.05, L is 1.1394 and 7.6308, poles minus 1.1197 plus or minus 0.8653 i, only 1.415 radians per second against the controller's 1.0025: below the 2 to 5 rule. Jitter 0.0622 and error 0.0191, against 0.1737 and 0.1082 for m equal 3; the price is a gentler start-up, peak error 1.9660 against 8.4183. At sigma 0.005 the poles move to minus 3.2020 plus or minus 3.1221 i, at 0.2 to minus 0.7124 plus or minus 0.0495 i.
- Module 13 went from a block diagram to an autopilot's brain, and here it adds gains chosen by optimisation with an observer to feed them. The answer to 13.6's growing effort is one dial: N equals the square root of 1 plus q over r, 10.0499 at 100. It left out nonlinear control, delay-dominated loops and discrete-time design. The next unbuilt lesson in BACKLOG order is the capstone: a six-degree-of-freedom flight simulator with an autopilot. It is not yet written.
The cost: pricing error against effort
Take the cruise plant of 13.6, with , , , . Score the whole trajectory:
is a symmetric matrix of weights on the state error and a positive weight on the control. is small only if the state returns to zero quickly and the input stays modest. A designer who cares only about the speed error uses : a weight on and none on the engine state . Then .
Doubling both weights changes nothing about which trajectory is best, so only the ratio matters for the gain: one knob, where pole placement had two, and the optimisation decides where the poles go.
The Riccati equation and the gain
Suppose the best cost from a start is for a symmetric . In a short time we pay and changes by ; optimality says the best makes the total zero:
Setting the derivative in to zero gives , so
The optimal control is linear state feedback, the form of 13.6, with a gain we did not guess. Substituting back, the bracket must vanish for every , which is the algebraic Riccati equation (ARE):
We want its symmetric positive semi-definite solution, which gives a stable when is controllable and the weighted states are visible in (stated without proof).
Solving it numerically. A simple method for a browser is Kleinman’s iteration (Newton’s method on the ARE, from memory). Start from a stabilising gain, here since is stable. Repeat: solve the linear Lyapunov equation for , then set . It converges quadratically: passes for the lab’s default design, for . The lab and exercise implement exactly this.
Worked example 1: a scalar plant by hand. For the ARE is , so and
With , and we get , and a pole at . The more we weigh the error, the further left the pole goes; with small, is near zero for a stable plant, so the optimiser leaves it alone.
Worked example 2: the cruise plant. Take and (explained below). The lab’s Riccati solution is and
with the feedforward gain of 13.6. Against 13.6’s , (, ) the speed is the same, but LQR picked . The full-state step has overshoot and settles in s.
Sweeping the ratio: what the optimiser does to the poles
The lab’s first plot sweeps (here , ):
| closed-loop poles | |||
|---|---|---|---|
When error is cheap the poles barely leave and : the controller spends effort only when it buys something. As the ratio grows the poles sweep left and settle into a pair with ( at , at ; the Butterworth pattern, from memory). And , the command when the step arrives, follows a clean law.
Why . Break the loop at the plant input: . Write in the ARE, multiply on the left by and on the right by , and use . With ,
At the cruise plant has and , so ; the lab prints at .
Back to 13.6. There the command went as and we could only watch it climb. Here each tenfold increase in multiplies the opening command by about . LQR does not remove the cost of speed; it makes the exchange rate a single dial.
Guaranteed margins and the rule for choosing weights
The identity says at every frequency, whatever and : the Nyquist curve never enters the unit disc centred at . Two consequences, the second from memory.
- Phase margin. At gain crossover , write . Then , so .
- Gain margin. The curve can cross the negative real axis only left of , so the gain can rise without limit and fall by half: .
The lab confirms it: at and . The phase margin is at rad/s for the default design and at rad/s for . At there is no crossover, since .
The fine print. The guarantees hold for full-state feedback with the loop opened at the input. They say nothing about delay or sensor noise, and with an observer they are lost (Doyle’s LQG counterexample, from memory).
Choosing and . Bryson’s rule (from memory): and , the reciprocals of the largest tolerable deviation of each state and of the input. For an acceptable error of and a throttle limit of : , , worked example 2. The opening command sits right at the limit; the rule is a start and the sliders decide the rest. By the identity, keeping needs .
Observers: states you cannot read
The car has a speed sensor and no engine-state dial: we have and want . Run a copy of the plant inside the controller, drive it with the same input, and correct it by the output it gets wrong. This is the Luenberger observer:
Subtract it from : the input cancels and the error obeys
We place the eigenvalues of by choosing . This is the controller problem for the dual pair , , so Ackermann’s formula of 13.6 applies and all poles can be placed when the observability matrix has full rank. For the cruise plant it is with determinant . With only the engine state measured, , the matrix has rank one: does not depend on , so the speed could never be recovered.
Worked example 3: placing the observer by hand. For ,
The LQR design has natural frequency . A rule of thumb (from memory) puts the observer two to five times faster, so the estimate has converged before the controller needs it. For : , gives and , poles (the lab’s readout). The large infers the unseen engine state from the slope of the speed signal.
The separation principle
Now close the loop with the estimate, . Write :
In coordinates the matrix is block triangular, , so its eigenvalues are those of the diagonal blocks. The poles of the combined system are those of together with those of : design the controller as if the state were measured and the observer as if there were no controller. This is the separation principle.
The lab shows it: at the matrix of has eigenvalues and . If the estimate starts correct () the output-feedback response is the full-state one exactly, and s.
What separation does not say. It fixes the poles, not the transient. With the initial estimate off by (the lab default) the start-up leaks into the command through : at the step has overshoot, settles in s, peaks at a command of rather than , and peaks at . Sweeping :
| overshoot (%) | |||||
| settling (s) | |||||
| peak command | |||||
| peak |
Beyond the settling barely improves while the command and the transient grow fast.
Noise, the Kalman filter and the dual
A real sensor adds noise to , and a fast observer, with its large , passes it into the estimate and the command. With the lab’s seeded noise (, held s at a time, seed ) the figures after s are:
| rms of | |||||
| rms estimation error |
Noise-free, the jitter at and is only and , so the growth is all noise. A slow observer ignores noise but reacts late; a fast one shakes. The right depends on how noisy the sensor is against how much the plant surprises us.
The Kalman filter settles that trade-off, and it is the LQR problem in disguise. Model unmodelled disturbance as white noise (here unit intensity on the input channel, , a choice) and sensor noise as white with variance . The steady-state gain is with from the same Riccati equation with and in place of and : the noise levels play the roles of and , and the observer is the dual of the controller. A quiet sensor makes the filter trust the measurement and the gain large; a noisy one makes it trust the model.
At the lab gives and observer poles , only rad/s against the controller’s , below the two-to-five rule (a rule of thumb, not a law). The noisy run has command jitter and estimation error , beating the placement’s and ; the price, in the noise-free run, is a gentler start-up (peak against ) and slower s settling. The filter re-tunes with the sensor: gives poles and gives .
Sensor fusion for attitude is the same idea in one dimension. A gyro gives the rate cleanly but its integral drifts; an accelerometer gives the angle without drift but noisily. The observer trusts the gyro at high frequency and the accelerometer at low (a complementary filter), and the Kalman filter picks from the noise levels, as in the attitude equations of 12.4 6-DOF Aircraft Equations of Motion.
A Module 12 connection
13.6 moved the Dutch roll of 12.6 Lateral-Directional Modes and found that dragging every pole needed rad of rudder per unit of yaw-rate reference: in LQR terms, an far too small. Weights set from the rudder travel (Bryson) give poles the rudder can reach. The sensor gap is the other half: a rate gyro reads and but the sideslip velocity is hard to measure, so an observer on the lateral model estimates it.
Concept checks
Playground and exercise
The first cell solves the Riccati equation by Kleinman’s iteration; the second builds observers and checks the combined eigenvalues; the exercise has you write the LQR and Kalman gains.
Problems
For (an unstable plant, ) with cost , find , and the closed-loop pole.
Show worked solution
With , , the ARE is , that is , with roots and . We want the positive root, . Then and the pole is . Check with the formula: and the pole is .
Find that puts both poles of at for the cruise plant.
Show worked solution
The characteristic polynomial is , to be matched with . Then and , so . Check: has trace and determinant . The gain multiplies the speed error and feeds the engine state, which is only seen through the slope of : the observer converts a speed discrepancy into a correction to with a large factor.
For the cruise plant the opening command of a unit step is and the throttle accepts at most . Find the largest that fits, then test Bryson’s rule with an acceptable speed error of and .
Show worked solution
gives . Bryson gives , , so and : twice the throttle available. Accept a larger error, or slow the reference. The rule is a start; the identity says which way to move.
What Module 13 gave you, and what comes next
Module 13 went from a block diagram to an autopilot’s brain: the loop and its time response (13.1, 13.2), PID and its traps (13.3), stability by roots and by frequency (13.4, 13.5), full-state pole placement (13.6) and, here, gains chosen by optimisation and an observer to feed them. It left out nonlinear control, delay-dominated loops and discrete-time design.
The next lesson in BACKLOG order is the capstone on a six-degree-of-freedom flight simulator with an autopilot (16.2 Capstone: 6-DOF Flight Simulator with Autopilot).
Key Takeaways
- LQR minimises with , and from the Riccati equation; Kleinman’s iteration solves it with a Lyapunov solve per pass.
- Only matters. On the cruise plant, gives and poles ; gives .
- The opening step command is ( at ): the answer to 13.6’s growing effort is a single dial.
- gives a phase margin of at least for full-state LQR (, in the lab); not guaranteed once an observer is added.
- The observer has error dynamics and needs a full-rank observability matrix.
- Separation: the combined poles are those of and , but the start-up leaks into the command (peak against ).
- Faster observers amplify noise ( at , at ); the Kalman filter, the dual LQR problem, sets the speed from the noise levels ( at ).