DiscreteLQRegulatorGains
DiscreteLQRegulatorGains[sspec,wts,τ]
gives the discretetime state feedback gains with sampling period τ for the continuoustime system specification sspec that minimizes a cost function with weights wts.
DiscreteLQRegulatorGains[…,"prop"]
gives the value of the property "prop".
Details and Options
 DiscreteLQRegulatorGains is also known as discrete linear quadratic regulator, discrete linear quadratic cost equivalent regulator or discrete linear quadratic emulated regulator.
 DiscreteLQRegulatorGains is typically used to compute a digital implementation of a regulating controller or tracking controller.
 A regulating controller aims to maintain the system at an equilibrium state despite disturbances pushing it away. Typical examples include maintaining an inverted pendulum in its upright position or maintaining an aircraft in level flight.
 The regulating controller is given by a control law of the form , where is the computed gain matrix.
 The continuoustime cost function is given by .
 A tracking controller aims to track a reference signal despite disturbances interfering with it. Typical examples include a cruise control system for a car or path tracking for a robot.
 The tracking controller is given by a control law of the form , where is the computed gain matrix for the augmented system, which includes the system sys as well as the dynamics for .
 The approximate discretetime system:
 The continuoustime cost function is given by , where are the augmented states.
 The number of augmented states is given by , where is given by SystemsModelOrder of sys, the order of y_{ref} and the number of signals y_{ref}.
 The choice of weighting matrices results in a tradeoff between performance and control effort, and a good design is arrived at iteratively. Their starting values can be diagonal matrices with entries , where z_{i} is the maximum admissible absolute value of the corresponding x_{i} or u_{i}.
 DiscreteLQRegulatorGains computes the discretetime controller using an approximated discretetime equivalent of a continuoustime cost function.
 The discretetime approximated cost function is , with the following terms:

state weight matrix input weight matrix crosscoupling weight matrix state vector for regulation and for tracking  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 is the system sys together with the u_{f}, y_{t} and y_{ref} specifications.
 The system sys can be given as StateSpaceModel[{a,b,c,d}], where a, b, c and d represent the state, input, output and feedthrough matrices in the continuoustime system .
 The discretetime design model dsys is a zeroorder hold approximation with the following terms:

state matrix input matrix  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} "TrackedOutputs" None the tracked outpus y_{t} "TrackedSignal" Automatic the dynamics of y_{ref}  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.
 DiscreteLQRegulatorGains[…,"Data"] returns a SystemsModelControllerData object cd that can be used to extract additional properties using the form cd["prop"].
 DiscreteLQRegulatorGains[…,"prop"] can be used to directly give the value of cd["prop"].
 Possible values for properties "prop" include:

"Design" type of controller design "DesignModel" model used for the design "DiscreteTimeClosedLoopPoles" poles of "DiscreteTimeClosedLoopSystem" "DiscreteTimeClosedLoopSystem" dcsys {"DiscreteTimeClosedLoopSystem",cspec} whether to merge the discretetime closedloop system "DiscreteTimeControllerModel" dcm "DiscreteTimeDesignModel" approximated discretetime model dsys "DiscreteTimeOpenLoopPoles" poles of dsys "DiscreteTimeWeights" weights ϕ, ρ, π of the approximated cost "FeedbackGains" gain matrix κ or its equivalent "DiscreteTimeFeedbackGainsModel" dgm or {dgm_{1},dgm_{2}} "FeedbackInputs" inputs u_{f} of sys used for feedback "InputModel" input model sys "InputCount" number of inputs u of sys "OpenLoopPoles" poles of "DesignModel" "OutputCount" number of outputs y of sys "SamplingPeriod" sampling period τ "StateCount" number of states x of sys "TrackedOutputs" outputs y_{t} of sys that are tracked  Possible keys for cspec include:

"InputModel" input model in csys "Merge" whether to merge csys "ModelName" name of csys  The diagram of the approximated discretetime regulator layout.
 The diagram of the approximated discretetime tracker layout.
The approximate discretetime system:
Examples
open allclose allBasic Examples (4)
The system specification sspec of a system with feedback input u_{f} and exogenous input u_{e}:
A set of regulator weights and a sampling period:
The discretetime LQ regulator gains:
A nonlinear system with feedback input u:
A set of regulator weights and a sampling period:
The discretetime regulator gains:
The discretetime system with an output to be tracked:
A set of weights and a sampling period:
A set of regulator weights and a sampling period:
The openloop and discretetime closedloop poles can be obtained as properties:
The unstable openloop poles are on the right half of the s plane:
The stable closedloop poles are within the unit circle of the z plane:
Scope (26)
Basic Uses (7)
Compute the discretetime state feedback gain of a system:
The discretetime approximation is stable:
The discretetime closedloop system is even more stable:
The gain for an unstable system:
The discretetime approximation is also unstable:
The discretetime closedloop system is stable:
The gains for various sampling periods:
The discretetime approximations:
The discretetime closedloop systems:
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 multipleinput system:
Reverse the weights of the feedback inputs:
A higher weight does not lead to a smaller norm:
Increase the weight even more to reduce the relative signal size:
Compute the gains when the cost function contains crosscoupling of the states and feedback inputs:
Plant Models (5)
A descriptor StateSpaceModel:
A SystemModel:
Tracking (3)
Properties (11)
DiscreteLQRegulatorGains returns the discretetime 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 discretetime closedloop system:
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 poles of the design model:
The discretetime approximate model used to compute the feedback gains:
The poles of the approximate discretetime model:
The approximate discretetime weights:
Properties related to the input model:
Applications (12)
Mechanical Systems (5)
Regulate the motion of a springmassdamper system with a nonlinear spring:
The openloop response of the cart to a disturbance force f_{e} is unregulated and takes ~40 seconds to settle:
Specify a set of control weights and a sampling time for the controller design:
Obtain the closedloop system:
The cart's motion is regulated and it settles in ~3 seconds:
Regulate the swinging motion of a springpendulum:
The motion of the pendulum is unregulated:
Set the system specifications:
Specify a set of control weights and a sampling time for the controller design:
Obtain the discretetime closedloop system:
Only the swinging motion θ is regulated:
It is not possible to completely control the system:
Only some poles are affected by the controller:
Dampen the oscillations of a rotary pendulum:
The openloop response to a perturbation is oscillatory:
Specify a set of control weights and a sampling time:
Compute the discretetime LQR:
Obtain the closedloop system:
The oscillations are damped by the controller:
The discretetime controller model:
Keep a ballbot robot upright:
Without a controller, the robot is tips over:
Specify a set of regulator weights and a sampling time:
Obtain the discretetime closedloop system:
The robot returns to the upright position despite an initial disturbance in its states:
Obtain the discretetime controller model:
Make a toy train stop at stations using a tracking controller:
A displacement of the train's locomotive's position will cause unregulated oscillations:
This is because its openloop poles are lightly damped:
The train's route modeled as a piecewise function:
Specify the position of the train's locomotive as the tracked output:
Specify a set of control weights and a sampling period:
Obtain the closedloop system:
The train follows the route and makes the 3 stops:
The engine and cart velocities during the route:
Aerospace Systems (3)
Stabilize an aircraft's pitch:
A model of the aircraft's longitudinal dynamics:
The aircraft's pitch δ is unstable to a step input:
This is because there is a pole at the origin of the s plane, making it unstable:
Specify a set of control weights and sampling time for the discretetime LQR controller design:
Compute the discretetime LQR controller:
Obtain the discretetime closedloop system:
The discretetime closedloop system's poles are within the unit circle, making it stable:
Obtain the discretetime controller model:
Regulate the orbit of a satellite with a thruster failure:
A model of the satellite's orbital dynamics:
Without corrective thruster inputs, a perturbation in the states will cause the satellite's orbit to deviate:
The orbit is controllable if the tangential thrusters fail, but not if the radial thrusters fail:
Set the system specification to control the satellite using only the tangential thrusters:
Specify a set of control weights and sampling time:
Obtain the closedloop system:
The satellite's orbit is regulated using only the tangential thruster:
Obtain the discretetime controller model:
Suppress the fluid slosh disturbance on an accelerating rocket:
A model of the rocket that approximates the fluid slosh as a swinging pendulum:
The sloshing makes the system unstable:
The controllability matrix is not full rank, as only six of the eight states are controllable:
Determine indices of state pairs that are uncontrollable:
Obtain a controllable model by deleting the third pair of uncontrollable states:
A set of control weights and sampling times:
Compute a discretetime LQR controller:
Obtain the closedloop system:
Biological Systems (1)
Regulate the concentration of alcohol in the human body:
A twocompartment model with gastrointestinal and intravenous inputs:
Linearize the system using StateSpaceModel:
Without intervention, it takes for the body to regulate the alcohol concentration:
Specify a set of control weights and a sampling time:
Obtain the discretetime closedloop system:
The alcohol concentration is regulated faster:
Chemical Systems (1)
Control a fedbatch reactor's biomass concentration:
A nonlinear model of the reactor:
The unregulated system's response to a perturbation of the states:
Set the system specification to track the output :
And specify a set of control weights and sampling period:
Obtain the discretetime closedloop system:
Simulate the system, tracking a constant biomass concentration of 1.25:
Electrical Systems (1)
Improve the disturbance rejection of a permanent magnet synchronous motor (PMSM):
It takes around to settle to a stepinput disturbance:
Set the control system specifications:
Specify a sampling period and a set control weights for a maximum control effort of 24v:
Obtain the closedloop system:
The closedloop system takes ~5 seconds to settle to a stepinput disturbance:
Marine Systems (1)
Control the depth and pitch of a submarine:
Without a controller, the submarine's pitch and depth are unstable to a disturbance in the states:
Set the depth and pitch , which are outputs 1 and 2, as tracked outputs:
Specify a set of control weights and a sampling period:
Compute the discretetime LQR controller:
Obtain the closedloop system:
The submarine tracks the reference depth of –10 and the pitch angle of 0:
Properties & Relations (5)
DiscreteLQRegulatorGains is computed as the gains for an emulated discretetime system:
A set of weights and a sampling period for the continuoustime model:
The emulated discretetime system:
The state weight matrix for the emulated system:
The crosscoupling weight matrix:
The discrete LQ gains using the emulated system and weights:
DiscreteLQRegulatorGains gives the same result:
The discretetime system is an approximation of the sampleddata system:
The controller data for a set of weights and sampling periods:
The approximate discretetime closedloop system:
Its state response for initial conditions :
The discretetime feedback law:
The equations of the sampleddata system for initial conditions :
The state response of the sampleddata system:
Compare the approximate discrete and sampleddata responses:
Decreasing the sampling period better approximates the sampleddata system:
The discretetime closedloop systems and feedback gains for the various :
The state responses for the initial condition :
The state responses of the sampleddata systems:
As the sampling period decreases, the difference between the systems' responses also decreases:
Decreasing the sampling period gives a better approximation of the sampleddata system's control effort:
The state responses of the discretetime system from the previous example:
The state responses of the sample data system from the same example:
The control signals for initial condition :
The sampleddata system's control effort:
As the sampling period decreases, the difference between the systems' control effort also decreases:
Decreasing the sampling period results in closedloop poles closer to the unit circle, i.e. closer to instability:
The discretetime closedloop systems:
As the sampling period decreases, the system is less stable:
Text
Wolfram Research (2010), DiscreteLQRegulatorGains, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscreteLQRegulatorGains.html (updated 2021).
CMS
Wolfram Language. 2010. "DiscreteLQRegulatorGains." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/DiscreteLQRegulatorGains.html.
APA
Wolfram Language. (2010). DiscreteLQRegulatorGains. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscreteLQRegulatorGains.html