explainer
Pole placement: calculate state-feedback gains
Use pole placement to calculate position and velocity gains for a cart. Verify the closed-loop matrix, compare exact responses, and inspect the force each design requires.
What you will learn
- Calculate feedback gains by matching a desired characteristic polynomial.
- Verify the eigenvalues of the closed-loop state matrix.
- Explain why pole placement alone gives no actuator or robustness guarantee.
Before you start
A cart sits one meter from its target. You can choose how its motion decays by calculating two feedback gains. Moving the poles farther left also changes the force that produces that motion.
Use pole placement to design the state response
Pole placement chooses a feedback gain matrix so the closed-loop state matrix has specified eigenvalues. For a continuous linear model, eigenvalues with negative real parts produce asymptotically decaying state motion. The initial state determines how much each mode contributes.
This lesson designs a regulator that returns position and velocity to zero. It does not add a tracking reference or an integral state. Åström and Murray's state-feedback chapter gives the general reachability and eigenvalue-assignment result; the cart calculation below is an original two-state example.
Declare the cart and its state
A horizontal cart has mass m = 2 kg and viscous damping b = 1 N·s/m. Applied force u acts along its position coordinate p. We omit springs, friction thresholds, delays, and actuator dynamics.
ṗ = v
m v̇ = u − bv
x = [p, v]ᵀ
A = [[0, 1], [0, −b/m]], B = [[0], [1/m]]
ẋ = Ax + Bu
Position uses meters, velocity uses meters per second, and force uses newtons. State entries have different units, so their numerical coefficients must respect that state order. The state-space lesson explains how to build these equations from a physical model.
With no feedback, A has eigenvalues 0 and −0.5 s⁻¹. Damping removes velocity, but a cart at rest can remain at any position. The zero eigenvalue captures that missing return-to-origin behavior.
Close the loop with two measured states
Give the controller exact position and velocity measurements. The feedback law applies a force proportional to both states:
u = −Kx = −kₚp − kᵥv
K = [kₚ, kᵥ]
A − BK = [[0, 1], [−kₚ/m, −(b + kᵥ)/m]]
The position gain kₚ has units N/m. The velocity gain kᵥ has units N·s/m. At positive position, the position term pulls toward the origin; the velocity term opposes the current motion when kᵥ is positive.
For this cart, the law also has the form of proportional position control plus measured-velocity damping. The state-space view makes the matrix and its eigenvalues explicit. Estimating velocity from position would add another design problem, covered by the state-estimation discussion in Output Feedback.
Check which poles feedback can move
For a finite-dimensional, time-invariant linear system, full controllability allows assignment of the entire characteristic polynomial through state feedback. Real-valued gains require nonreal desired poles to occur in complex-conjugate pairs. An uncontrollable mode keeps its original eigenvalue under this feedback.
The cart's controllability matrix has full rank:
[B, AB] = [[0, 1/m], [1/m, −b/m²]]
det([B, AB]) = −1/m² = −0.25 ≠ 0
This is an algebraic rank test using the declared coordinates. It imposes no maximum force. The controllability and observability lesson separates reachable state directions from the measurements needed to distinguish them.
If a system has an uncontrollable but stable mode, feedback can still stabilize its controllable part. Full pole assignment and stabilization therefore ask different questions. Our cart has no such fixed mode once its force input enters the loop.
Match the desired characteristic polynomial
Compute the determinant of sI − (A − BK). It gives a quadratic whose coefficients depend directly on the two gains:
det(sI − (A − BK)) = s² + ((b + kᵥ)/m)s + kₚ/m
Desired polynomial: s² + αs + β
kₚ = mβ, kᵥ = mα − b
Here α has units s⁻¹ and β has units s⁻². For distinct desired poles −r₁ and −r₂, expand (s + r₁)(s + r₂): α = r₁ + r₂ and β = r₁r₂. These equations calculate K without trial-and-error gain tuning.
The calculation assigns eigenvalues for the declared model. It does not minimize a force cost or choose the best poles for a task. Design criteria must supply those choices.
The linear quadratic regulator supplies one such criterion: a stated cost on state deviation and applied force. Its cart example solves for the gains, then checks the resulting response and remaining cost.
Place poles at minus one and minus two
Choose −1 and −2 s⁻¹. The desired polynomial is s² + 3s + 2, so α = 3 s⁻¹ and β = 2 s⁻².
kₚ = 2 × 2 = 4 N/m
kᵥ = 2 × 3 − 1 = 5 N·s/m
A − BK = [[0, 1], [−2, −3]]
det(sI − (A − BK)) = (s + 1)(s + 2)
Starting at p(0) = 1 m and v(0) = 0 m/s gives the exact response below, with time t expressed in seconds. The coefficients carry the position and velocity units.
p(t) = 2e⁻ᵗ − e⁻²ᵗ m
v(t) = −2e⁻ᵗ + 2e⁻²ᵗ m/s
u(t) = 2e⁻ᵗ − 6e⁻²ᵗ N
At one second, p = 0.600424 m, v = −0.465088 m/s, and u = −0.076253 N. Initial force is −4 N. Later, positive force can brake motion toward the origin even while position remains positive.
Compare distinct, repeated, and complex poles
The experiment uses a positive rate ρ and three pole families. Each produces real gains and stable continuous dynamics.
| Desired poles | α | β | Position response from p₀ = 1 m, with v₀ in m/s |
|---|---|---|---|
| −ρ, −2ρ | 3ρ | 2ρ² | (2p₀ + v₀/ρ)e⁻ρᵗ − (p₀ + v₀/ρ)e⁻²ρᵗ |
| −ρ, −ρ | 2ρ | ρ² | [p₀ + (v₀ + ρp₀)t]e⁻ρᵗ |
| −ρ + jρ, −ρ − jρ | 2ρ | 2ρ² | e⁻ρᵗ[p₀ cos(ρt) + (p₀ + v₀/ρ)sin(ρt)] |
The repeated-root case can contain a t e⁻ρᵗ term. Its coefficient depends on the initial state; a repeated pole does not require that term to appear in every trajectory. The conjugate pair introduces a damped oscillatory mode with angular frequency ρ rad/s.
Pole families alone do not rank all trajectories by speed. For example, both distinct and complex families have the same position gain at a given ρ, but different velocity gains. Poles and zeros also explains why an input-output response needs more information than pole locations alone.
Inspect motion and the force behind it
Keep the initial velocity at zero and double the pole rate. In each family, β and kₚ grow by a factor of four, so the magnitude of the initial force also grows fourfold. The velocity gain follows a different formula because the physical damping already contributes to α.
Then change the initial velocity while keeping the poles fixed. The response and initial force change, but the matrix eigenvalues remain the same. Replay time only selects a point on those curves.
Blue crosses mark closed-loop poles. The repeated family shows two poles at one location with a surrounding ring. Position and force use separate plots because their units differ.
The plot axes rescale to contain each response. Their limits use conservative continuous-time bounds, and they do not report peak values. Exact formulas generate the displayed states; joining samples is a drawing operation, with no numerical integration in the model.
Keep the design assumptions visible
The following assumptions determine what these plots establish:
- Available state: the controller knows p and v without noise or delay. An observer adds estimation dynamics and assumptions.
- Correct plant: the gains use m = 2 kg and b = 1 N·s/m. Different parameters change the achieved eigenvalues.
- Ideal actuation: the full command reaches the cart immediately. A force clamp would change the equations whenever it activates.
- No external load: the only resisting force is the declared viscous damping.
- Continuous feedback: the controller updates without sampling or computation delay.
For example, keep the default gains but add a constant external force d = 1 N. The equilibrium becomes p = d/kₚ = 0.25 m, v = 0. The original stable pole locations do not remove that position offset.
Integral action in state space adds accumulated tracking error as a third state. The worked design places all three poles and shows how the integrator supplies the force needed to reject a constant load.
Beard and colleagues' control textbook discusses how actuator saturation limits achievable response speed. Read actuator dynamics and controller discretization before interpreting these ideal curves as a hardware design. The lab applies neither limitation.
Eight seconds is a viewing window. A small endpoint value alone gives no settling-time guarantee; step-response characteristics explains the all-future-times condition. Stability here follows from the exact model's poles, with no claim about an unmeasured robot.
Reproduce the gain and response calculations
This standard-library example calculates each pole family at ρ = 1 s⁻¹ and t = 1 s. It evaluates closed-form solutions, then checks force using u = −kₚp − kᵥv. The final two rows change the initial state and add the separate constant-load equilibrium calculation.
from math import cos, exp, sin
def sample(family, rate=1.0, v0=0.0, t=1.0):
alpha = (3 if family == "distinct" else 2) * rate
beta = (1 if family == "repeated" else 2) * rate**2
kp, kv = 2 * beta, 2 * alpha - 1
decay = exp(-rate * t)
if family == "distinct":
c1, c2 = 2 + v0 / rate, -1 - v0 / rate
p = c1 * decay + c2 * decay**2
v = -rate * c1 * decay - 2 * rate * c2 * decay**2
elif family == "repeated":
c = v0 + rate
p = decay * (1 + c * t)
v = decay * (c - rate * (1 + c * t))
else:
c = 1 + v0 / rate
p = decay * (cos(rate * t) + c * sin(rate * t))
v = rate * decay * ((c - 1) * cos(rate * t)
- (1 + c) * sin(rate * t))
return kp, kv, p, v, -kp * p - kv * v
for family in ("distinct", "repeated", "complex"):
kp, kv, p, v, u = sample(family)
print(f"{family}: kp={kp:.6f}, kv={kv:.6f}; "
f"p={p:.6f} m, v={v:.6f} m/s, u={u:.6f} N")
kp, kv, p, v, u = sample("repeated", v0=-1)
print(f"Repeated, v0=-1: p={p:.6f} m, u={u:.6f} N")
print(f"Default gains, 1 N load: equilibrium p={1 / 4:.6f} m")
Expected output:
distinct: kp=4.000000, kv=5.000000; p=0.600424 m, v=-0.465088 m/s, u=-0.076253 N
repeated: kp=2.000000, kv=3.000000; p=0.735759 m, v=-0.367879 m/s, u=-0.367879 N
complex: kp=4.000000, kv=3.000000; p=0.508326 m, v=-0.619120 m/s, u=-0.175945 N
Repeated, v0=-1: p=0.367879 m, u=0.367879 N
Default gains, 1 N load: equilibrium p=0.250000 m
Try two pole-placement exercises
Exercise 1. For the same cart, place poles at −2 and −3 s⁻¹. Find kₚ and kᵥ, verify the polynomial, and calculate the force at p = 0.2 m and v = −0.1 m/s.
Show the gain and force calculation
The desired polynomial is (s + 2)(s + 3) = s² + 5s + 6. Therefore kₚ = 2 × 6 = 12 N/m and kᵥ = 2 × 5 − 1 = 9 N·s/m.
Substituting into the cart polynomial gives s² + ((1 + 9)/2)s + 12/2 = s² + 5s + 6. The force is −12(0.2) − 9(−0.1) = −1.5 N.
Exercise 2. Choose repeated poles at −1 s⁻¹, p₀ = 1 m, and v₀ = −1 m/s. Does the position contain a nonzero t e⁻ᵗ term? Find position and force at one second.
Show the repeated-pole response
The coefficient v₀ + ρp₀ equals zero. Position is p(t) = e⁻ᵗ m and velocity is v(t) = −e⁻ᵗ m/s. This initial state excites a pure exponential response even though the matrix has a repeated eigenvalue.
The gains are kₚ = 2 N/m and kᵥ = 3 N·s/m. Force is −2e⁻ᵗ + 3e⁻ᵗ = e⁻ᵗ N, so both position and force equal 0.367879 in their respective units at one second.
Sources and further study
- Åström and Murray, Feedback Systems: State Feedback, for reachability, the closed-loop matrix, and characteristic-polynomial assignment.
- Åström and Murray, Feedback Systems: Output Feedback, for state observers and feedback based on estimated state.
- Beard and colleagues, Introduction to Feedback Control, chapters 8 and 11, for force limits and full-state feedback design.
Before choosing faster poles, write down the force limit and how you will obtain every state in Kx.