| name | state-space-control |
| description | State-space control — pole placement, LQR optimal control, Kalman filter observer, controllability/observability, separation principle, MATLAB design, gain scheduling, LPV systems. |
| metadata | {"priority":7,"promptSignals":{"phrases":["state space control","pole placement","LQR control","Kalman filter control","state feedback","controllability matrix","state space model"],"minScore":3}} |
State-Space Control — Complete Skill
State-Space Model
Continuous-time LTI system:
ẋ = A x + B u
y = C x + D u
x ∈ R^n = state vector; u ∈ R^m = input; y ∈ R^p = output
A: n×n state matrix; B: n×m input matrix; C: p×n output matrix; D: p×m direct feedthrough
Discrete-time:
x[k+1] = A_d x[k] + B_d u[k]
y[k] = C x[k] + D u[k]
Exact discretization:
A_d = exp(A T_s); B_d = A^(-1)(A_d - I) B [if A invertible]
Or matrix exponential: [A_d, B_d] = expm([A B; 0 0] × T_s)
Controllability and Observability
Controllability matrix:
C_M = [B, AB, A²B, ..., A^(n-1)B]
System controllable ⟺ rank(C_M) = n
Observability matrix:
O = [C; CA; CA²; ..., CA^(n-1)]
System observable ⟺ rank(O) = n
PBH test (Popov-Belevitch-Hautus):
Controllable ⟺ [A-λI, B] has rank n for all eigenvalues λ
Observable ⟺ [A-λI; C] has rank n for all eigenvalues λ
Uncontrollable modes: eigenvalues of A that cannot be moved by state feedback
Unobservable modes: eigenvalues of A that cannot be seen from output
Pole Placement (Full State Feedback)
Control law: u = -K x [assume D = 0 for simplicity]
Closed-loop: ẋ = (A - B K) x; eigenvalues of (A-BK) = desired poles
Desired poles selection:
- ωn and ζ from rise time and overshoot specifications
- Dominant poles: fastest desired dynamics; others 3–5× further left
- All poles must be in left half-plane (stable); all real parts < 0
Ackermann's formula (SISO):
K = e_n^T C_M^(-1) × Δ_d(A)
e_n^T = [0,...,0,1]; Δ_d(s) = desired characteristic polynomial evaluated at A
MATLAB: K = place(A, B, desired_poles) [for MIMO too with extended method]
Better numerics: K = acker(A, B, desired_poles) [Ackermann; SISO only]
Linear Quadratic Regulator (LQR)
Optimal cost function:
J = ∫₀^∞ [x^T Q x + u^T R u] dt → minimize
Q = n×n positive semi-definite state weighting matrix
R = m×m positive definite input weighting matrix
Optimal gain:
K_LQR = R^(-1) B^T P
P = unique positive definite solution to Algebraic Riccati Equation (ARE):
A^T P + P A - P B R^(-1) B^T P + Q = 0
MATLAB: [K, P, e] = lqr(A, B, Q, R)
Q and R tuning (Bryson's rule):
Q_ii = 1 / x_i,max² (normalize by maximum acceptable state deviation)
R_jj = 1 / u_j,max² (normalize by maximum allowable input)
Then scale Q relative to R for balance between state regulation and control effort
Properties:
- Guaranteed stability margin: gain margin ≥ 6 dB; phase margin ≥ 60°
- Guaranteed robustness: not guaranteed with estimator; use LQG/Loop Transfer Recovery (LTR)
Kalman Filter (Linear Quadratic Estimator)
System with noise:
ẋ = A x + B u + G w [w = process noise; G = process noise input]
y = C x + v [v = measurement noise]
Noise statistics:
E[w w^T] = Q_n; E[v v^T] = R_n [power spectral density matrices]
Kalman filter (steady-state, time-invariant):
x̂̇ = A x̂ + B u + L(y - C x̂)
L = P C^T R_n^(-1) [optimal observer gain]
P = steady-state error covariance; satisfies continuous Riccati:
A P + P A^T - P C^T R_n^(-1) C P + G Q_n G^T = 0
MATLAB: L = lqr(A', C', GQ_nG', R_n)' [dual of LQR; or use kalman() directly]
Separation Principle (LQG Design)
LQG = LQR + Kalman filter; guaranteed to be stable if each is stable independently
Full controller:
u = -K x̂ (LQR feedback on estimated state)
x̂̇ = A x̂ + B u + L (y - C x̂) (Kalman state estimation)
Separation of design: design K and L independently; closed-loop eigenvalues = poles from K + poles from L
LQG Limitation: no guaranteed gain/phase margin (unlike LQR alone)
LQG/LTR: Loop Transfer Recovery adds robustness; augment Q_n → recover LQR robustness at plant input
Observer Design (General)
Luenberger observer (deterministic):
x̂̇ = A x̂ + B u + L (y - C x̂)
Error dynamics: ė = (A - LC) e
Poles of (A-LC) placed to left of closed-loop poles by factor 3–10
MATLAB: L = place(A', C', observer_poles)'
Rule: observer poles 3–10× faster than controller poles (for good tracking of actual states)
Compromise: very fast observers → amplify measurement noise
Integral Action (Tracking and Disturbance Rejection)
Augment system with integrator for each output to track:
Add integrator state x_I: ẋ_I = r - y = r - Cx
Augmented state: x_aug = [x; x_I]; augmented system: [A, 0; -C, 0] [B; 0]
Then design K_aug for augmented system → includes integral gain
Eliminates steady-state error to step reference and step disturbance (type 1 system)
Gain Scheduling
Linear Parameter Varying (LPV) systems: dynamics depend on scheduling parameter θ(t)
ẋ = A(θ) x + B(θ) u; y = C(θ) x
Gain scheduling: design K(θ) at grid of θ values; interpolate online
Linear interpolation: K(θ) = K_1 × w_1(θ) + K_2 × w_2(θ) + ...
Stability guarantee: only local at each design point; interpolated gains may not stabilize
LPV design (proper): design single K(θ) with LMI constraints → guaranteed stability in θ range
Discrete-Time Control
Emulation: design continuous K(s); discretize to K(z) via Tustin or ZOH; works if T_s < T_dominant/10
Direct discrete design: use A_d, B_d, C matrices in place and LQR functions; more accurate for slower sampling
Digital LQR:
J = Σ [x^T Q x + u^T R u]; discrete Riccati equation
MATLAB: [K, P, e] = dlqr(Ad, Bd, Q, R)
Kalman predictor vs. filter:
Predictor: estimate x[k+1|k]; used for prediction
Filter: estimate x[k|k]; used for current state
Output
Provide: state-space matrices (A, B, C, D), controllability/observability check (rank), LQR gain matrix K (with Q, R specification), observer gain L, closed-loop eigenvalues (pole locations), time-domain response (rise time, settling time, overshoot) from closed-loop simulation, Kalman filter noise matrices Q_n, R_n, separation principle stability confirmation, and MATLAB code outline for implementation.