Computing Library › Control Theory
Control Theory

Linear-Quadratic Regulator (LQR)

LQR computes the state-feedback gain that minimizes a quadratic cost trading state error against control effort, yielding a robust optimal controller.

Optimal State Feedback

The linear-quadratic regulator designs state feedback u = -K*x not by placing poles by hand, but by minimizing a cost. For the system x' = A*x + B*u, the cost is the integral over all time of x-transpose*Q*x plus u-transpose*R*u. The first term penalizes state deviation, the second penalizes control effort.

The weighting matrices

Kronos motion — traffic controller

The solution

The optimal gain is K = R^(-1)*B-transpose*P, where P is the unique positive-definite solution of the algebraic Riccati equation A-transpose*P + P*A - P*B*R^(-1)*B-transpose*P + Q = 0. Reliable numerical solvers for this equation make LQR routine even for high-order systems.

Why engineers favor it

LQR handles multi-input multi-output systems in one step, always yields a stable closed loop if the system is stabilizable and detectable through Q, and comes with strong guaranteed robustness margins: at least 6 dB of gain margin and 60 degrees of phase margin at each input. These built-in margins are a major reason for its popularity.

Tuning in practice

Rather than choosing Q and R element by element, engineers often use Bryson's rule: set each diagonal weight to the reciprocal of the square of the maximum acceptable value for that variable. This normalizes the variables and gives a sensible starting point that is then adjusted by inspecting the response.

LQR assumes the full state is measured. When only outputs are available it is paired with a Kalman filter, and the combination is the linear-quadratic-Gaussian controller.