State-Space Analysis and Control
A transfer function relates one output to one input and hides everything inside: the capacitor voltages and inductor currents, the shaft speed that a position servo never reports, and any unstable mode that cancels between numerator and denominator. State-space analysis keeps those internal variables in view. It writes a system of any order as first-order differential equations in matrix form, and it handles several inputs and outputs as easily as one.
That view supports design methods that classical tools cannot express. State feedback can place every closed-loop pole, an observer can estimate states that no sensor measures, and the linear quadratic regulator computes gains by minimizing a cost. The methods took their modern form around 1960 in the work of Rudolf Kalman, and they now run inside motor drives, power converters, and aerospace guidance systems.
Every system here is linear and time-invariant, as a real system is approximately for small changes about an operating point, and a position servo serves as the running example. Laplace Transform covers the transfer functions, poles, and zeros used throughout, and Time-Domain Response of Control Systems ties pole locations to overshoot and settling time.
State Variables and State Equations
The state of a system is the smallest set of variables whose present values, together with future inputs, determine all future behavior. In a circuit, the natural states are the capacitor voltages and inductor currents, which carry the stored energy and cannot change instantaneously; in a mechanism, positions and velocities play that role. The number of independent energy stores sets the order n of the system.
A linear time-invariant system with n states, m inputs, and p outputs obeys two matrix equations:
dx/dt = Ax + Bu
y = Cx + Du
Here x is the state vector, u the input vector, and y the output vector. The first line is the state equation. The second, the output equation, contains no derivatives, so every output is a fixed combination of the present states and inputs.
| Matrix | Size | Name | What it describes |
|---|---|---|---|
| A | n × n | State matrix | How the states drive one another's rates of change |
| B | n × m | Input matrix | How each input drives the state derivatives |
| C | p × n | Output matrix | Which combinations of states the outputs report |
| D | p × m | Feedthrough matrix | The part of each output that follows an input instantly |
This article writes a matrix row by row inside square brackets, with commas between entries and semicolons between rows: [a, b; c, d] has rows a, b and c, d, and [x1; x2] is a column vector. Numbers inside brackets carry no thousands separators, a superscript T marks the transpose, and I is the identity matrix.
A Series RLC Circuit
A voltage source u drives a resistance R, an inductance L, and a capacitance C in series. Take the inductor current i and the capacitor voltage vC as states, so that x = [i; vC]. Kirchhoff's voltage law and the capacitor's current law give
L di/dt = u − Ri − vC, and C dvC/dt = i
Dividing by L and by C gives
A = [−R/L, −1/L; 1/C, 0], B = [1/L; 0]
As an output, the capacitor voltage uses the row [0, 1] with D = 0, and the inductor voltage, u − Ri − vC, uses [−R, −1] with D = 1, because a step in the source voltage appears across the inductor at once. With R = 10 Ω, L = 10 mH, and C = 100 µF, A = [−1000, −100; 10000, 0] and B = [100; 0] in SI units. Transient Response of RC, RL, and RLC Circuits derives this circuit's behavior from its second-order differential equation instead.
A DC Motor
A permanent-magnet DC motor turning an inertia combines mechanical and electrical states. Take the shaft angle θ, the speed ω, and the armature current i as states, and the applied voltage v and a load torque TL as inputs. Newton's law for the rotor and Kirchhoff's law for the armature give
dθ/dt = ω, J dω/dt = Kti − bω − TL, and La di/dt = v − Rai − Keω
where J is the inertia, b the viscous friction coefficient, Kt the torque constant, Ke the back-EMF constant (numerically equal to Kt in SI units), and Ra and La the armature resistance and inductance. With x = [θ; ω; i] and u = [v; TL],
A = [0, 1, 0; 0, −b/J, Kt/J; 0, −Ke/La, −Ra/La], B = [0, 0; 0, −1/J; 1/La, 0]
The load torque enters through the second column of B. The examples below use the motor from the speed-loop example in Time-Domain Response of Control Systems: Kt = Ke = 0.05 N·m/A, Ra = 1 Ω, negligible friction, and J = 1.25 × 10−4 kg·m2, which give a speed gain of 20 (rad/s)/V and a 50 ms mechanical time constant, plus an assumed armature inductance of 1 mH. Then
A = [0, 1, 0; 0, 0, 400; 0, −50, −1000], B = [0, 0; 0, −8000; 1000, 0]
From State Equations to Transfer Functions
The Laplace transform of the state equation is sX(s) − x(0) = AX(s) + BU(s). Solving for the state gives
X(s) = (sI − A)−1x(0) + (sI − A)−1BU(s)
With zero initial state, the output is Y(s) = G(s)U(s), where
G(s) = C(sI − A)−1B + D
With m inputs and p outputs, G(s) is a p × m matrix whose entry in row i and column j is the transfer function from input j to output i. The inverse (sI − A)−1 equals the adjugate of sI − A divided by det(sI − A), the characteristic polynomial, whose roots are the eigenvalues of A. Every pole of G(s) is therefore an eigenvalue of A, but the converse can fail: when a factor of det(sI − A) cancels against the numerator, that eigenvalue vanishes from G(s) while remaining in the system.
For the series RLC circuit, det(sI − A) = s2 + (R/L)s + 1/(LC), and (sI − A)−1B equals [s/L; 1/(LC)] divided by that polynomial. The two output choices then give
VC(s)/U(s) = [1/(LC)] / [s2 + (R/L)s + 1/(LC)]
VL(s)/U(s) = s2 / [s2 + (R/L)s + 1/(LC)]
a low-pass and a high-pass response that share one pair of poles. With the numbers above, the denominator is s2 + 1,000s + 1,000,000, a natural frequency of 1,000 rad/s with a damping ratio of 0.5.
The state is not unique. Any invertible matrix T defines new states z through x = Tz, giving dz/dt = T−1ATz + T−1Bu and y = CTz + Du. Because T−1AT is similar to A, the new model has the same eigenvalues and transfer function, and such similarity transformations build the canonical forms described below.
Solving the State Equation
The scalar equation dx/dt = ax + bu has the solution x(t) = eatx(0) + ∫0t ea(t − τ)bu(τ) dτ. The vector equation has the same solution with the matrix exponential, defined by the series
eAt = I + At + (At)2/2! + (At)3/3! + …
which converges for every square matrix A and every t. It equals I at t = 0, its derivative is AeAt, and its Laplace transform is (sI − A)−1. From an initial state x(0) at t = 0, the complete solution is
x(t) = eAtx(0) + ∫0t eA(t − τ)Bu(τ) dτ
and the output is y(t) = Cx(t) + Du(t). The first term is the zero-input response, set by the initial state alone, and the second is the zero-state response, a convolution of the input with eAtB. Because eAt carries the state from one instant to a later one, it is also called the state-transition matrix.
Modes and Eigenvectors
If A has n linearly independent eigenvectors vi, with eigenvalues λi, collect them as the columns of a matrix V. Then A = VΛV−1, where Λ is the diagonal matrix of eigenvalues, and
eAt = VeΛtV−1
where eΛt is diagonal with entries eλit. The free response is therefore a sum of modes, each keeping the shape of its eigenvector while it grows or decays as eλit. Complex eigenvalues of a real matrix come in conjugate pairs, which combine into decaying or growing sinusoids, and a repeated eigenvalue without a full set of eigenvectors adds terms such as teλt.
A Closed Form for Two States
A real 2 × 2 matrix with complex eigenvalues σ ± jωd has a compact exponential. The Cayley–Hamilton theorem, which says that every square matrix satisfies its own characteristic equation, gives (A − σI)2 = −ωd2I, and the series collapses to
eAt = eσt[cos(ωdt) I + (sin(ωdt)/ωd)(A − σI)]
For the RLC circuit, σ = −500 s−1 and ωd = 866 rad/s, so A − σI = [−500, −100; 10000, 500]. With the capacitor charged to 10 V, no current, and a short circuit in place of the source, x(0) = [0; 10] and u = 0. Then, with t in seconds,
i(t) = −1.155e−500t sin(866t) A
vC(t) = 10e−500t[cos(866t) + 0.577 sin(866t)] V
After 1 ms the current is −0.534 A, flowing against its reference direction as the capacitor discharges, and the capacitor holds 6.60 V; after 2 ms it holds 1.51 V.
For larger systems, summing the series can lose accuracy badly to cancellation, as Cleve Moler and Charles Van Loan explain in "Nineteen Dubious Ways to Compute the Exponential of a Matrix" (SIAM Review, 1978, revisited in 2003). MATLAB's expm and SciPy's scipy.linalg.expm use scaling and squaring with Padé approximants instead.
Eigenvalues and Stability
The eigenvalues of A are the roots of the characteristic equation det(sI − A) = 0, and each mode of the free response behaves as eλt, so the eigenvalues classify the free response:
- Asymptotically stable: Every eigenvalue has a negative real part, and every free response decays to zero. Such a matrix is called Hurwitz.
- Marginally stable: No eigenvalue has a positive real part, at least one lies on the imaginary axis, and each eigenvalue there has as many independent eigenvectors as its multiplicity. Free responses stay bounded but need not decay, as in an undamped LC tank, with eigenvalues ±j/√(LC), or in the motor's angle, with an eigenvalue at 0.
- Unstable: Some eigenvalue has a positive real part, or a repeated eigenvalue on the imaginary axis lacks a full set of eigenvectors and produces terms such as t or t sin ωt that grow without bound.
The motor's eigenvalues are 0, −20.4, and −979.6 s−1. They belong to the angle, which integrates speed, to a mechanical mode with a 49 ms time constant, and to an electrical mode with a 1.02 ms time constant.
Internal Stability and BIBO Stability
A transfer function is bounded-input, bounded-output (BIBO) stable when all its poles lie in the open left half-plane. Because a cancellation can remove an eigenvalue from G(s), BIBO stability does not guarantee that the internal states stay bounded. Consider
A = [0, 1; 2, −1], B = [0; 1], C = [−1, 1], D = 0
The eigenvalues of A are +1 and −2, yet G(s) = (s − 1)/[(s − 1)(s + 2)] = 1/(s + 2). The unstable mode's eigenvector is [1; 1], which C maps to zero, so from x(0) = [0.001; 0.001] the output stays at zero while both states grow as et, reaching 22 after 10 s. In hardware such a state grows until an amplifier saturates or a component fails, and only the eigenvalues of A reveal it.
Lyapunov's Method
For the RLC circuit with its source shorted, the stored energy E = Li2/2 + CvC2/2 changes at the rate dE/dt = −Ri2, so it never increases, and because the current cannot stay at zero unless the capacitor voltage is also zero, the energy drains away completely. Aleksandr Lyapunov generalized this argument in his 1892 doctoral thesis on the stability of motion. A symmetric matrix P is positive definite when xTPx > 0 for every nonzero x, and positive semidefinite when xTPx ≥ 0. A is Hurwitz if and only if, for any symmetric positive definite Q, the Lyapunov equation ATP + PA = −Q has a symmetric positive definite solution P, and xTPx is then an energy function that decreases along every trajectory except the equilibrium.
Controllability and Observability
Two questions decide what feedback can do with a state model: can the inputs move every state, and can the outputs reveal every state? Kalman introduced both concepts in a paper to the first congress of the International Federation of Automatic Control, held in Moscow in 1960, and the rank tests below come from his work of that period.
Controllability
A system is controllable if some input can drive the state from any initial value to any target value in finite time. A linear time-invariant system is controllable if and only if its controllability matrix,
Mc = [B, AB, A2B, …, An−1B]
has rank n. Its blocks sit side by side, so Mc has n rows and nm columns, and for a single input the test reduces to a nonzero determinant. Higher powers of A add nothing, because the Cayley–Hamilton theorem expresses An through lower powers.
An equivalent test, named for Vasile Popov, Vitold Belevitch, and Malo Hautus, examines one eigenvalue at a time: the system is controllable if and only if [λI − A, B] has rank n for every eigenvalue λ of A. An eigenvalue that fails belongs to an uncontrollable mode, which no input can influence and no state feedback can move. A system whose uncontrollable modes are all stable is called stabilizable.
Two identical RC low-pass sections driven from one source are uncontrollable. With the capacitor voltages as states and a common time constant τ, A = [−1/τ, 0; 0, −1/τ] and B = [1/τ; 1/τ], so Mc = [1/τ, −1/τ2; 1/τ, −1/τ2], of rank 1. The difference v1 − v2 obeys d(v1 − v2)/dt = −(v1 − v2)/τ whatever the input, so no input can open or close the gap, but the gap decays: the pair is uncontrollable yet stabilizable. With time constants of 10 ms and 11 ms the pair becomes controllable, but barely: setting the capacitors to +0.5 V and −0.5 V within 50 ms takes 220 times the input energy that charges both to 1 V. The controllability Gramian, which sets that minimum energy, measures what the yes-or-no rank test cannot.
Observability
A system is observable if the output over a finite interval, together with the known input, determines the initial state and hence every later state. It is observable if and only if the observability matrix, which stacks C, CA, and so on as rows,
Mo = [C; CA; CA2; …; CAn−1]
has rank n. The eigenvalue form of the test requires [λI − A; C] to have rank n for every eigenvalue λ, and a system whose unobservable modes are all stable is called detectable. By duality, (A, C) is observable exactly when (AT, CT) is controllable, so every controllability result has an observability twin.
The choice of sensor matters. A tachometer on the motor measures speed, so C = [0, 1, 0] and
Mo = [0, 1, 0; 0, 0, 400; 0, −20000, −400000]
Its first column is zero and its rank is 2, so the angle is unobservable. No state equation has the angle on its right side, so speed and current evolve the same way wherever the shaft points. An encoder, with C = [1, 0, 0], gives Mo = [1, 0, 0; 0, 1, 0; 0, 0, 400], of rank 3: the angle's rate of change gives the speed, and the speed's rate of change reveals the current.
Minimal Realizations and Canonical Forms
In Kalman's canonical decomposition, a suitable change of coordinates separates any state model into four parts: controllable and observable, controllable but unobservable, uncontrollable but observable, and neither. Only the first part appears in the transfer function. A realization is minimal when it is both controllable and observable. Its eigenvalues are then exactly the poles of its transfer function, and for one input and one output its number of states equals the degree of the denominator of G(s) after all common factors cancel. Any two minimal realizations of the same G(s) are related by a similarity transformation.
Controllable Canonical Form
For the strictly proper third-order transfer function
G(s) = (b2s2 + b1s + b0)/(s3 + a2s2 + a1s + a0)
the controllable canonical form, also called the phase-variable form, chains integrators and feeds the denominator coefficients back:
A = [0, 1, 0; 0, 0, 1; −a0, −a1, −a2], B = [0; 0; 1], C = [b0, b1, b2], D = 0
The pattern extends to any order, with ones above the diagonal, the negated denominator coefficients in the last row, and the numerator coefficients in C. The realization is always controllable, and it is observable unless the numerator and denominator share a factor. If they have equal degree, polynomial division first splits off a constant, which becomes D. Texts and tools order the states differently; SciPy's tf2ss, for example, places the negated coefficients in the first row.
Observable Canonical Form
Transposing the controllable form, with Ao = AT, Bo = CT, and Co = BT, gives the observable canonical form:
Ao = [0, 0, −a0; 1, 0, −a1; 0, 1, −a2], Bo = [b0; b1; b2], Co = [0, 0, 1]
A scalar transfer function equals its own transpose, so both forms realize the same G(s). The observable form is always observable, and it is controllable unless a common factor exists. By duality, state-feedback calculations are simplest in controllable form and observer calculations in observable form.
Modal Form and Numerical Conditioning
When A has distinct eigenvalues, choosing T = V, the eigenvector matrix, makes T−1AT diagonal, so each state is one mode. A zero row in T−1B then marks an uncontrollable mode, and a zero column in CT an unobservable one. Companion forms, by contrast, are numerically fragile, because small errors in the coefficients of a high-order polynomial can move its roots a long way, so numerical work favors modal or balanced realizations. IIR Filter Structures meets the same problem when quantized coefficients perturb the poles of high-order direct-form filters.
State Feedback and Pole Placement
When every state is measured, the controller can feed all of them back:
u = −Kx + krr
where K is an m × n gain matrix, r is the reference, and kr is a reference gain. The closed loop obeys dx/dt = (A − BK)x + Bkrr, so its poles are the eigenvalues of A − BK. The pole-placement theorem, proved for several inputs by W. M. Wonham in 1967, states that these eigenvalues can be put at any chosen locations, with complex values in conjugate pairs, if and only if (A, B) is controllable. State feedback moves poles but not zeros, so a right-half-plane zero still limits performance.
For low order, the gains follow from matching det(sI − A + BK) to the desired characteristic polynomial αc(s) = sn + αn−1sn−1 + … + α0. In controllable canonical form the match is immediate: A − BK keeps its companion structure, its last row becomes [−(a0 + k1), −(a1 + k2), …], and each gain ki+1 = αi − ai is the distance its coefficient must move. Large moves need large gains, which saturate actuators, amplify sensor noise, and excite dynamics the model omits. A practical design takes a dominant pair from the specifications, puts the other poles a few times farther left or on a Bessel or ITAE pattern, and then checks the margins, because closed-loop poles say nothing directly about robustness.
Ackermann's Formula
In 1972 Jürgen Ackermann published a formula that performs the canonical-form calculation without changing coordinates:
K = [0, 0, …, 0, 1] Mc−1 αc(A)
where αc(A) = An + αn−1An−1 + … + α0I is the desired polynomial evaluated with the matrix A in place of s. The system must have a single input, so that Mc is square, and must be controllable, so that Mc is invertible. The formula follows from the Cayley–Hamilton theorem and serves discrete-time systems unchanged, but it is numerically fragile, because inverting Mc loses accuracy as the order rises or controllability weakens.
With several inputs, many gain matrices place the same poles, and the spare freedom can buy robustness. MATLAB's place uses the 1985 algorithm of Kautsky, Nichols, and Van Dooren to reduce the sensitivity of the closed-loop poles to perturbations, and SciPy's scipy.signal.place_poles offers that method alongside its default Tits–Yang algorithm.
The Reference Gain
State feedback alone drives x to zero. For a single output y = Cx to settle at a constant reference r, the steady state must satisfy 0 = (A − BK)xss + Bkrr and Cxss = r, which with D = 0 gives
kr = −1/[C(A − BK)−1B]
This gain exists when the plant has no zero at s = 0. It depends on an exact model, and a constant disturbance still leaves an error, which integral action removes.
Worked Example: A Position Servo
The motor drives a load to a commanded angle from a 24 V amplifier, with sensors for both angle and speed. Its electrical time constant is one-fiftieth of its mechanical one, so the design starts from a second-order model with x = [θ; ω] and the angle as output:
A = [0, 1; 0, −20], B = [0; 400], C = [1, 0]
Here 20 s−1 is 1/τm, and 400 rad/s2 per volt is Kt/(JRa). The specification asks for a damping ratio of 0.7 and a natural frequency of 50 rad/s.
- Check controllability. Mc = [B, AB] = [0, 400; 400, −8000] has a determinant of −160,000, so the poles can go anywhere.
- Write the target. The specification gives αc(s) = s2 + 70s + 2,500, with roots −35 ± j35.7.
- Apply Ackermann's formula. Mc−1 = [0.05, 0.0025; 0.0025, 0] and αc(A) = A2 + 70A + 2500I = [2500, 50; 0, 1500]. The last row of Mc−1, [0.0025, 0], times αc(A) gives K = [6.25, 0.125], in volts per radian and volts per radian per second. As a check, A − BK = [0, 1; −2500, −70] has eigenvalues −35 ± j35.7.
- Set the reference gain. kr = −1/[C(A − BK)−1B] = 6.25, equal to k1, because at rest with no load the drive voltage must be zero. The response from r to θ is 2,500/(s2 + 70s + 2,500), the second-order prototype with no zeros.
- Simulate. A 1 rad step overshoots by 4.6 percent, peaks at 88 ms, and settles within 2 percent in 120 ms. The drive starts at 6.25 V and never exceeds it, so steps of up to about 3.8 rad stay inside the 24 V limit.
- Check the neglected dynamics. Applied to the three-state model without current feedback, the same gains move the dominant pair only to −36.3 ± j37.1 and add a pole at −927 s−1. The overshoot stays at 4.6 percent, and settling takes 116 ms.
- Check the margins. The loop broken at the plant input, L(s) = K(sI − A)−1B = 50(s + 50)/[s(s + 20)], crosses unity gain at 61 rad/s with a phase margin of 69 degrees. Its phase never reaches −180 degrees, so the gain margin is unlimited.
- Find the weakness. A load torque of 0.05 N·m, equivalent to a 1 V drop in drive voltage, leaves a steady error of 1/k1 = 0.16 rad, because only an angle error can produce the voltage that balances the load. The next two sections remove the speed sensor and then this error.
Observers and the Separation Principle
State feedback needs every state, but sensors add cost and noise, and some states cannot be measured at all. An observer, described by David Luenberger in 1964, runs a copy of the model and corrects the copy with the output error:
dx̂/dt = Ax̂ + Bu + L(y − Cx̂)
where x̂ is the estimate and L, an n × p matrix, is the observer gain. Subtracting this from the plant's state equation shows that the estimation error e = x − x̂ obeys
de/dt = (A − LC)e
The input drops out, so the eigenvalues of A − LC alone set how fast the error decays. By duality, they can be placed anywhere, in conjugate pairs, if and only if (A, C) is observable: design a feedback gain for the pair (AT, CT) and transpose it. For a single output, Ackermann's formula becomes L = αo(A)Mo−1[0; …; 0; 1], with αo(s) the desired observer polynomial.
An Observer for the Servo
Suppose the servo has only its encoder, so y = θ. Observer poles with ζ = 0.7 and ωn = 200 rad/s, four times faster than the controller, give αo(s) = s2 + 280s + 40,000. Here Mo = [1, 0; 0, 1], so L is the last column of αo(A) = [40000, 260; 0, 34800]: L = [260; 34800], in s−1 and s−2. The eigenvalues of A − LC are −140 ± j142.8, and an error in the estimated speed decays to 2 percent of its initial value in about 30 ms.
The Separation Principle
Now feed back the estimate instead of the state: u = −Kx̂ + krr. In the coordinates [x; e], the closed loop is
d[x; e]/dt = [A − BK, BK; 0, A − LC][x; e] + [Bkr; 0]r
The matrix is block triangular, so its eigenvalues are those of A − BK together with those of A − LC. Controller and observer can be designed separately, and joining them moves neither set of poles: for the servo, the combined model's eigenvalues are −35 ± j35.7 and −140 ± j142.8. Because the reference enters the plant and the observer identically, it cannot excite the estimation error, so with a correct initial estimate the step response matches the full-state design.
The principle rests on assumptions that practice can break:
- A linear plant: Saturation, dead zones, and friction couple the two designs.
- An accurate model: If the observer's A, B, or C differs from the plant's, the error equation picks up terms in x and u, and the eigenvalue sets no longer separate.
- The same input: When the amplifier clips, the observer needs the clipped value, not the commanded one.
- Nominal stability only: Separation guarantees pole locations, not robustness. John Doyle's 1978 paper "Guaranteed Margins for LQG Regulators" answered its implied question in a three-word abstract: "There are none."
A common rule of thumb places observer poles two to six times faster than the controller poles: a faster observer needs a larger L and passes more sensor noise into the estimate, and a slower one lets estimation transients show in the response. For a linear system with Gaussian noise of known statistics, the Kalman filter, published in 1960, chooses the gain that minimizes the mean-square estimation error, and pairing it with the linear quadratic regulator gives linear quadratic Gaussian (LQG) control. The State Observers section of Control Algorithms describes the Luenberger, extended Kalman filter, sliding-mode, and disturbance observers that motor drives use to estimate speed, position, and load torque.
Integral Action
The servo's 0.16 rad load error has the classical cure, an integrator. With D = 0, add a state that integrates the tracking error,
dxI/dt = y − r = Cx − r
and feed it back with the plant states, u = −Kx − kIxI. The augmented state [x; xI] has the matrices
Aa = [A, 0; C, 0], Ba = [B; 0]
and any pole-placement method designs the combined gain [K, kI]. At steady state the integrator's input must be zero, so y equals r exactly despite any constant disturbance or model error, provided the closed loop stays stable. Bruce Francis and W. M. Wonham generalized this in 1976 as the internal model principle: robust rejection of a class of signals requires a model of their generator inside the loop, such as an integrator for constants or an oscillator for sinusoids. For one input and one output, the augmented system is controllable if and only if (A, B) is controllable and the square matrix [A, B; C, 0] is invertible, which for a minimal plant means that it has no zero at s = 0.
Integral Action for the Servo
For the servo, Aa = [0, 1, 0; 0, −20, 0; 1, 0, 0] and Ba = [0; 400; 0]. Keeping the dominant pair at −35 ± j35.7 and adding a pole at −50 s−1 gives the target (s2 + 70s + 2,500)(s + 50) = s3 + 120s2 + 6,000s + 125,000. Matching the closed-loop polynomial s3 + (20 + 400k2)s2 + 400k1s + 400kI gives k1 = 15 V/rad, k2 = 0.25 V/(rad/s), and kI = 312.5 V/(rad·s). With the reference entering only through the integrator, a 1 rad step overshoots by 1.5 percent, settles within 2 percent in 96 ms, and needs at most 2.1 V. The same load torque now deflects the shaft by at most 0.054 rad, 40 ms after it arrives, and the error then returns to zero.
In practice the integrator winds up while the actuator saturates, so controllers clamp xI or stop integrating while the drive is limited.
The Linear Quadratic Regulator
Rather than asking the designer for poles, the linear quadratic regulator (LQR), which Kalman also solved, chooses the state-feedback gain that minimizes a weighted cost:
J = ∫0∞ (xTQx + uTRu) dt
The symmetric positive semidefinite matrix Q penalizes state deviation, and the symmetric positive definite matrix R penalizes input effort. The minimizing control is u = −Kx with K = R−1BTP, where P is the symmetric positive semidefinite solution of the algebraic Riccati equation
ATP + PA − PBR−1BTP + Q = 0
If (A, B) is stabilizable and every mode that does not decay on its own shows up in the cost, which formally means that (A, H) is detectable for a matrix H with HTH = Q, that solution is unique and A − BK is stable.
Bryson's rule, from Arthur Bryson and Yu-Chi Ho's Applied Optimal Control, gives starting weights: make Q and R diagonal, with Qii = 1/(xi,max)2 and Rjj = 1/(uj,max)2, where each maximum is the largest acceptable value of its variable. Each term then contributes about 1 to the integrand at its limit, and simulation refines the weights. Scaling Q and R together leaves K unchanged.
LQR for the Servo
Penalize only the angle of the two-state servo, with an acceptable error of 1 rad, and limit the drive to the amplifier's 24 V: Q = [1, 0; 0, 0] rad−2 and R = 1/576 V−2. The Riccati solution gives K = [24, 0.3] and closed-loop poles at −70 ± j68.6, a damping ratio of 0.71. With kr = 24, a 1 rad step overshoots by 4.0 percent and settles within 2 percent in 61 ms, and the drive starts at exactly the 24 V that the weights encoded. For this plant k1 = √(Q11/R), the largest allowed voltage divided by the largest allowed error.
Loosening the acceptable error to 10 rad gives k1 = 2.4 V/rad, a natural frequency of 31 rad/s, and a damping ratio of 0.78. Tightening it to 0.1 rad gives 240 V/rad, 310 rad/s, and 0.71, but with the armature inductance restored, that fast design's damping ratio falls to 0.57.
Guaranteed Margins
LQR gains come with guaranteed margins when every state is measured and fed back, R is diagonal if there are several inputs, and the loop is broken at the plant input. The loop then tolerates any increase in gain, any reduction by less than a factor of 2 (6 dB), and phase shifts of up to 60 degrees in each input channel. For a single input the guarantee follows from the return-difference inequality |1 + L(jω)| ≥ 1, which keeps the Nyquist plot of the loop gain outside the unit circle centered on −1; the three servo designs have 66 to 75 degrees of phase margin. The guarantee does not survive an observer, as Doyle's paper showed, and discrete-time LQR carries weaker guarantees.
Discrete-Time State Space
A controller running on a microcontroller or DSP updates its output once per sampling period T and holds it constant in between, a zero-order hold. Over each period the state equation then has an exact solution, and sampling the plant gives
x[k + 1] = Adx[k] + Bdu[k], y[k] = Cx[k] + Du[k]
Ad = eAT, Bd = (∫0T eAτ dτ)B
Both matrices come from one exponential: the exponential of the block matrix [A, B; 0, 0] multiplied by T is [Ad, Bd; 0, I]. The model is exact at the sampling instants; choosing T and other discretization methods are matters of digital control design. The transfer function is H(z) = C(zI − Ad)−1Bd + D, and Z-Transform develops the z-domain tools.
Each eigenvalue λ of A becomes an eigenvalue eλT of Ad, so the left half of the s-plane maps inside the unit circle, and a discrete-time system is asymptotically stable when every eigenvalue of Ad has a magnitude less than 1. For the servo sampled every millisecond,
Ad = [1, 0.000990; 0, 0.980199], Bd = [0.000199; 0.396027]
Design in Discrete Time
The controllability and observability tests, Ackermann's formula, and observer design carry over with Ad and Bd in place of A and B and with target poles in the z-plane. Mapping the servo's target poles through z = esT gives 0.96499 ± j0.03447, and Ackermann's formula gives Kd = [6.096, 0.1237], close to the continuous gains because 1 kHz sampling is far faster than the closed-loop dynamics.
Sampling can destroy controllability or observability, but only when two eigenvalues of A share a real part and their imaginary parts differ by a whole multiple of 2π/T. An undamped 50 Hz oscillator sampled exactly twice per cycle, at T = 10 ms, has Ad = −I, so its controllability matrix [Bd, AdBd] = [Bd, −Bd] has rank 1; at T = 9 ms the rank returns to 2.
Applications: Averaged Converter Models and Motor Drives
State-Space Averaging of Switching Converters
A switching converter is not time-invariant, because its circuit changes each time a switch turns on or off. R. D. Middlebrook and Slobodan Ćuk showed how to average it into a tractable model at the 1976 IEEE Power Electronics Specialists Conference. In continuous conduction the converter alternates between two linear circuits, with matrices A1 and B1 for the fraction d of each period and A2 and B2 for the rest, and weighting each by the time it applies gives
dx/dt = [d × A1 + (1 − d) × A2]x + [d × B1 + (1 − d) × B2]vin
which holds when the switching frequency lies well above the converter's natural frequencies, so that the ripple is small. Because d multiplies the state, the model is nonlinear. At a steady duty cycle D (not the feedthrough matrix), with A and B the averaged matrices, the operating point is X = −A−1BVin, and linearizing about it gives a duty-cycle input matrix of (A1 − A2)X + (B1 − B2)Vin.
For an ideal boost converter with inductor current and capacitor voltage as states, load resistance R, and output capacitance C, A1 = [0, 0; 0, −1/(RC)] with the switch on, A2 = [0, −1/L; 1/C, −1/(RC)] with it off, and B1 = B2 = [1/L; 0]. With D′ = 1 − D, the output is V = Vin/D′, the inductor current is IL = V/(D′R), and the duty-cycle-to-output transfer function is
Gvd(s) = [V/(D′RC)](D′2R/L − s) / [s2 + s/(RC) + D′2/(LC)]
The numerator vanishes at s = +D′2R/L, a right-half-plane zero, which is why a boost converter's output first dips when the duty cycle rises. With Vin = 12 V, D = 0.5, R = 10 Ω, L = 100 µH, and C = 220 µF, the output is 24 V, the resonant poles lie near 540 Hz, and the zero sits at 25,000 rad/s, about 3.98 kHz, so the voltage loop must cross over well below it. Switching Converter Control describes the loops built on such models. Averaged models miss effects near the switching frequency, such as the subharmonic oscillation of peak current-mode control.
Motor Drives
Motor drives use state-space models at several levels. In the rotor's d–q reference frame, a permanent-magnet synchronous motor's stator currents form a linear parameter-varying model with cross-coupling terms proportional to the electrical speed, which field-oriented control cancels by decoupling feedforward. Speed and position loops can use state feedback with integral action, as in the servo example, and a load-torque observer adds the load as a constant state: augmented this way, the servo model passes the observability test with the encoder as its only sensor. Sensorless drives estimate position and speed from measured currents and voltages, and model predictive control optimizes a cost over a short horizon at each sample using a discrete-time state model. Control Algorithms covers both.
Numerical Tools
Each calculation in this article takes a line or two in standard software:
- MATLAB with the Control System Toolbox: ss, tf, ctrb, obsv, place, lqr, lqi, c2d, and minreal, with eig and expm in MATLAB itself.
- Python with SciPy: scipy.signal.StateSpace, ss2tf, tf2ss, cont2discrete, and place_poles, with scipy.linalg.expm, solve_continuous_are, solve_discrete_are, and solve_continuous_lyapunov.
- Python with the python-control package: ss, ctrb, obsv, place, place_acker, lqr, dlqr, lqe, sample_system, and minimal_realization.
MATLAB's place and lqr and SciPy's place_poles all return K for the law u = −Kx, but conventions for state ordering and discretization vary between tools. A few habits keep the numbers trustworthy:
- Decide rank from singular values: A determinant scales with units and order, while singular values show how close a matrix is to losing rank; MATLAB's rank and NumPy's matrix_rank count those above a tolerance. With voltage as its only input, the motor's controllability matrix has singular values from about 109 down to 20, partly because its columns carry different units.
- Simulate beyond the linear model: Confirm each design in a simulation with saturation, sampling, delay, and sensor noise before trusting it in hardware.
Summary
A state-space model writes a system as dx/dt = Ax + Bu and y = Cx + Du, with one state for each independent energy store. It yields the transfer function C(sI − A)−1B + D, the time response through the matrix exponential, and stability through the eigenvalues of A, including unstable modes that a transfer function can hide.
Controllability decides whether state feedback can place every pole, and observability whether an observer can reconstruct every state; for a linear plant with an accurate model, the separation principle lets the two be designed independently. Integral action removes steady-state error, and the linear quadratic regulator balances state error against input effort. The same tools serve sampled systems, averaged converter models, and motor drives, provided each design is checked against saturation, noise, and the dynamics its model leaves out.