# LQGRegulator

LQGRegulator[sspec,cvs,wts]

gives the optimal output feedback controller for the stochastic system specification sspec with noise covariance matrices cvs that minimize a cost function with weights wts.

LQGRegulator[,"prop"]

gives the value of the property "prop".

# Details and Options    • LQGRegulator is also known as linear quadratic Gaussian controller or stochastic linear controller.
• LQGRegulator is used to compute a regulating controller or tracking controller for a system with disturbances and measurement noise modeled as zero-mean, Gaussian, white noise processes.
• LQGRegulator works by minimizing a quadratic cost function of the states and feedback inputs, and the sum of the variances of the error between the actual and estimated states.
• A regulating controller aims to maintain the system at an equilibrium state despite disturbances uw and ue interfering with it. 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 quadratic cost function with weights q, r and p of the states x and feedback inputs uf:
• continuous-time system discrete-time system
• A tracking controller aims to track a reference signal despite disturbances uw and ue 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 that includes the system sys as well as the dynamics for .
• • The quadratic cost function with weights q, r and p of the augmented states and feedback inputs uf:
• continuous-time system discrete-time system
• The number of states of the augmented system is given by , where is given by SystemsModelOrder of sys, the order of yref and the number of signals yref.
• 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 zi is the maximum admissible absolute value of the corresponding xi or ui.
• The weights wts can have the following forms:
•  {q,r} cost function with no cross-coupling {q,r,p} cost function with cross-coupling matrix p
• The measurements ym are modeled as , where and are the submatrices of and associated with , and is the noise.
• The stochastic inputs uw and the measurement noise yv are considered to be zero-mean, white and Gaussian:
• , process noise , measurement noise cross covariance
• The covariance matrices cvs can have the following forms:
•  {w,v} covariance matrices and zero cross covariance {w,v,h} covariance and cross covariance matrices
• The system specification sspec is the system sys together with the uf, ue, yt and yref specifications.
• 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 uf "ExogenousInputs" None the exogenous inputs ue "MeasuredOutputs" All the measured outputs ym "TrackedOutputs" None tracked outputs yt "TrackedSignal" Automatic the dynamics of yref
• The inputs and outputs can have the following forms:
•  {num1,…,numn} numbered inputs or outputs numi used by StateSpaceModel, AffineStateSpaceModel and NonlinearStateSpaceModel {name1,…,namen} named inputs or outputs namei used by SystemModel All uses all inputs or outputs None uses none of the inputs or outputs
• LQGRegulator[,"Data"] returns a SystemsModelControllerData object cd that can be used to extract additional properties using the form cd["prop"].
• LQGRegulator[,"prop"] can be used to directly get the value of cd["prop"].
• Possible values for properties "prop" include:
•  "ClosedLoopPoles" poles of "ClosedLoopSystem" "ClosedLoopSystem" system csys {"ClosedLoopSystem",cspec} detailed control over the form of the closed-loop system "ControllerModel" model cm "Design" type of controller design "EstimatorGains" gain matrix ℓ "EstimatorGainsDesignModel" model used for the estimator gains design "EstimatorRegulatorFeedbackModel" model with ue, ym as input and as output "EstimatorRegulatorModel" model erm with uf, ue, ym as input and as output "ExogenousInputs" deterministic and non-feedback inputs ue of sys "FeedbackGains" gain matrix κ or its equivalent "FeedbackGainsDesignModel" model used for the feedback gains design "FeedbackGainsModel" model gm or {gm1,gm2} "FeedbackInputs" inputs uf of sys used for feedback "InputModel" input model sys "InputsCount" number of inputs u of sys "MeasuredOutputs" measured outputs ym of sys "OpenLoopPoles" poles of the Taylor linearized sys "OutputsCount" number of outputs y of sys "SamplingPeriod" sampling period of sys "StateEstimatorModel" model sem "StateOutputEstimatorModel" model soem "StatesCount" number of states x of sys "TrackedOutputs" outputs yt 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 regulator layout.
• The diagram of the tracker layout.
• # Examples

open allclose all

## Basic Examples(1)

Construct an LQG regulator for a system with one measured output and one feedback input:

## Scope(34)

### Basic Uses(4)

A system with one feedback input and one noisy measurement:

The input covariance matrix is empty because there are no noisy inputs:

A set of weights for the states and feedback input:

Compute the regulator:

Compute the regulator from a full system specification:

A system with one feedback input, one noisy input and one noisy measurement:

A set of covariance matrices and weights:

Compute the regulator:

A system with an exogenous deterministic input as well:

A set of covariance matrices and weights:

Compute the regulator:

A general stochastic system:

A set of covariance matrices and weights:

Compute the regulator:

### Plant Models(7)

Continuous-time StateSpaceModel:

Discrete-time StateSpaceModel:

Descriptor StateSpaceModel:

A SystemModel with a noisy input:

The system specification:

A regulator design:

### Properties(15)

By default, LQGRegulator returns the controller comprising the estimator and regulator:

The feedback gains:

The feedback gains model:

The model used to compute the feedback gains:

The estimator gains:

The model of the state estimator:

The model used to compute the estimator gains:

For nonlinear systems, the model used to design the estimator is the nonlinear state-space model:

The model to design the feedback gains is linear:

It is essentially the Taylor linearized state-space model:

The controller is the estimator and feedback gains in series:

The computed controller is the same:

The closed-loop system:

The closed-loop poles:

The estimator-regulator feedback model:

In this model, the feedback input is fed back directly:

Assemble the estimator and regulator with feedback to get the same result as before:

The closed-loop system differs from the computed one only in the input matrix:

The design method:

Properties related to the input model:

Get the controller data object:

The list of available properties:

The value of a specific property:

### Tracking(5)

Design a tracking controller:

The closed-loop system tracks the reference signal :

Design a tracking controller for a discrete-time system:

The closed-loop system tracks the reference signal :

Track multiple outputs:

The closed-loop system tracks two different reference signals:

Compute the controller effort:

The controller model:

The controller inputs:

The controller effort:

Track a desired reference signal:

The reference signal is of order 4:

And a decaying sinusoid:

Design a controller to track one output of a first-order system:

The dimensions of the state weighting matrix qq are k+m q:

Compute the controller:

The closed-loop system tracks the reference:

### Closed-Loop System(3)

Assemble the closed-loop system for a nonlinear plant model:

The closed-loop system with a linearized model:

Compare the response of the two systems:

Assemble the merged closed-loop of a plant with an LQGRegulator:

The unmerged closed-loop system:

When merged, it gives the same result as before:

Explicitly specify the merged closed-loop system:

Create a closed-loop system with a desired name:

The closed-loop system has the specified name:

The name can be directly used in other functions:

## Applications(2)

A state-space model with one feedback input, one noisy input and one measurement:

Design an LQG controller:

Obtain the closed-loop system:

Simulate its response:

A descriptor system with one feedback input, one noisy input,\ and two noisy measurements:

The covariance matrices:

Create Gaussian noise sequences:

Interpolate the sequences to get noise signals:

The open-loop response is slow to settle: Design an LQG regulator:

The closed-loop system:

The closed-loop system has a faster settling time: ## Properties & Relations(2)

The closed-loop poles are the poles of the state-feedback and estimator subsystems:

The closed-loop poles:

The poles of the optimal state feedback subsystem:

The poles of the estimator:

The values are the same:

Construct an LQG regulator from the Kalman estimator and the optimal state-feedback gains model:

The Kalman estimator:

The feedback gains model:

Create the estimator-regulator manually:

LQGRegulator gives the same result: