LQRegulatorGains
LQRegulatorGains[spsec,wts]
gives the state feedback gains for the system specification sspec that minimizes a cost function with weights wts.
LQRegulatorGains[…,"prop"]
gives the value of the property "prop".
Details and Options
 LQRegulatorGains is also known as linear quadratic regulator, linear quadratic controller or optimal controller.
 LQRegulatorGains is typically used to stabilize a system or improve its performance.
 The controller is typically given by a state feedback , where is the computed gain matrix.
 The inputs u of sys consist of feedback inputs u_{f}and possibly other inputs u_{e}.
 The system specification sspec is the system sys together with the u_{f} specification.
 LQRegulatorGains minimizes a quadratic cost function with weights q, r and p of the states x and feedback inputs u_{f} of a linear system sys:

continuoustime system discretetime system  LQ design works for linear systems as specified by StateSpaceModel:

continuoustime system discretetime system  The resulting feedback gain matrix is then computed from algebraic Riccati equations:

continuoustime system and is the solution to the continuoustime algebraic Riccati equation discretetime system and is the solution to the discretetime algebraic Riccati equation .  The submatrix b_{f} is columns of b corresponding to the feedback inputs u_{f}.
 The weights wts can have the following forms:

{q,r} cost function with no crosscoupling {q,r,p} cost function with crosscoupling matrix p  The system specification sspec can have the following forms:

StateSpaceModel[…] linear control input and linear state AffineStateSpaceModel[…] linear control input and nonlinear state NonlinearStateSpaceModel[…] nonlinear control input and nonlinear state SystemModel[…] general system model <… > detailed system specification given as an Association  The detailed system specification can have the following keys:

"InputModel" sys any one of the models "FeedbackInputs" All the feedback inputs u_{f}  The feedback inputs can have the following forms:

{num_{1},…,num_{n}} numbered inputs num_{i} used by StateSpaceModel, AffineStateSpaceModel and NonlinearStateSpaceModel {name_{1},…,name_{n}} named inputs name_{i} used by SystemModel All uses all inputs  For nonlinear systems such as AffineStateSpaceModel, NonlinearStateSpaceModel and SystemModel, the system will be linearized around its stored operating point.
 LQRegulatorGains[…,"Data"] returns a SystemsModelControllerData object cd that can be used to extract additional properties using the form cd["prop"].
 LQRegulatorGains[…,"prop"] can be used to directly give the value of cd["prop"].
 Possible values for properties "prop" include:

"ClosedLoopPoles" poles of the linearized "ClosedLoopSystem" "ClosedLoopSystem" system csys with u_{e} and as input and y as output {"ClosedLoopSystem", cspec} detailed control over the form of the closedloop system "ControllerModel" model cm with and x as input and u_{f} as output "Design" type of controller design "DesignModel" model used for the design "FeedbackGains" gain matrix κ or its equivalent "FeedbackGainsModel" model gm with x as input and as output "FeedbackInputs" inputs u_{f} of sys used for feedback "InputModel" input model sys "InputsCount" number of inputs u of sys "OpenLoopPoles" poles of "DesignModel" "OutputsCount" number of outputs y of sys "SamplingPeriod" sampling period of sys "StatesCount" number of states x of sys  Possible keys for cspec include:

"InputModel" input model in csys "Merge" whether to merge csys "ModelName" name of csys
The diagram of the feedback gains model gm, controller model cm, and closedloop system csys.
Examples
open allclose allBasic Examples (5)
Compute the optimum feedback gain matrix for a continuoustime system:
Calculate the optimal control gains for an unstable system:
Compare the open and closedloop poles:
Compute the optimal statefeedback gain matrix for a discretetime system:
Calculate the feedback gains for controlling a twoinput system using the first input:
A set of feedback gains for a stabilizable but uncontrollable system:
Scope (26)
Basic Uses (7)
Compute the state feedback gain of a system with equal weighting for the state and input:
Compute the gain for an unstable system:
The gain stabilizes the unstable system:
Compute the state feedback gains for a multiplestate system:
The dimensions of the result correspond to the number of inputs and the system's order:
Compute the gains for a system with 3 states and 2 inputs:
Reverse the weights of the feedback inputs:
Typically, the feedback input with the bigger weight has the smaller norm:
Compute the gains when the cost function contains crosscoupling of the states and feedback inputs:
Choose the feedback inputs for multipleinput systems:
Compute the gains for a nonlinear system:
The controller is returned as a vector and takes operating points into consideration:
Plant Models (6)
Properties (10)
LQRegulatorGains returns the feedback gains by default:
In general, the feedback is affine in the states:
It is of the form κ_{0}+κ_{1}.x, where κ_{0} and κ_{1} are constants:
The systems model of the feedback gains:
An affine systems model of the feedback gains:
The poles of the linearized closedloop system:
Increasing the weight of the states makes the system more stable:
Increasing the weight of the feedback inputs makes the system less stable:
The model used to compute the feedback gains:
The gains of the design model and input model:
Properties related to the input model:
Get the controller data object:
ClosedLoop System (3)
Assemble the closedloop system for a nonlinear plant model:
The closedloop system with a linearized model:
Compare the response of the two systems:
Assemble the merged closed loop of a plant with one disturbance and one feedback input:
The unmerged closedloop system:
When merged, it gives the same result as before:
Explicitly specify the merged closedloop system:
Create a closedloop system with a desired name:
The closedloop system has the specified name:
The name can be directly used to specify the closedloop model in other functions:
Applications (3)
Compute a set of state feedback gains that stabilizes an unstable system:
The response of the closedloop system to a step input:
The openloop system is unstable:
Compute the Hessian of the cost function's integrand to determine the weighting matrices:
The natural response of the closedloop system:
Without feedback, the system is highly oscillatory:
Design a regulator for the discretetime model of a mixing tank system:
The response of the system to an impulse at the second input:
Properties & Relations (9)
A set of feedback gains for a stabilizable but uncontrollable system:
Find the optimal feedback gains for a continuoustime system:
The same solution can be obtained from the solution to the continuoustime Riccati equation:
Find the optimal feedback gains for a discretetime system:
The same solution can be obtained from the solution to the discretetime Riccati equation:
Find the loop gain transfer function for an LQR design:
Its Nyquist plot lies outside the unit circle centered at :
Consequently, the gain margin and the phase margin satisfies and :
The gains associated with a state increase as its weight is increased:
The higher penalty of the second state reduces its overshoot:
Find the optimal gains for a stable system as input cost is varied:
The gain converges to zero as approaches zero, or approaches infinity:
As the gain decreases, the closedloop poles move closer to the openloop ones:
Find the optimal gains for an unstable system as state cost is varied:
The gain converges to a minimum as approaches zero, or approaches infinity:
As k decreases, the closedloop poles move nearer the stable openloop poles and mirror images of unstable ones:
When approaches infinity, or approaches zero, the gain becomes unbounded:
As the gains increase, the states are penalized more, and their values become smaller:
The optimal costtogo is a Lyapunov function:
The state trajectory projected on the optimal cost surface asymptotically approaches the origin:
The optimal state trajectory for a system with one state:
The optimal cost satisfies the infinite horizon Hamilton–Jacobi–Bellman equation:
The optimal input minimizes the Hamiltonian, thus satisfying :
Possible Issues (4)
The gain computations fail for an unstabilizable system:
The gain computations fail if the control weighting matrix is not positive definite:
Use a positivedefinite control weighting matrix:
If has unobservable modes on the imaginary axis, there is no continuoustime solution:
The zero eigenvalue is unobservable:
If has unobservable modes on the unit circle, there is no discretetime solution:
Text
Wolfram Research (2010), LQRegulatorGains, Wolfram Language function, https://reference.wolfram.com/language/ref/LQRegulatorGains.html (updated 2021).
BibTeX
BibLaTeX
CMS
Wolfram Language. 2010. "LQRegulatorGains." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/LQRegulatorGains.html.
APA
Wolfram Language. (2010). LQRegulatorGains. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LQRegulatorGains.html