LinearquadraticGaussian (LQG) control is a modern statespace technique for designing optimal dynamic regulators and servo controllers with integral action (also known as setpoint trackers). This technique allows you to trade off regulation/tracker performance and control effort, and to take into account process disturbances and measurement noise.
To design LQG regulators and setpoint trackers, you perform the following steps:
Construct the LQoptimal gain.
Construct a Kalman filter (state estimator).
Form the LQG design by connecting the LQoptimal gain and the Kalman filter.
For more information about using LQG design to create LQG regulators , see LinearQuadraticGaussian (LQG) Design for Regulation.
For more information about using LQG design to create LQG servo controllers, see LinearQuadraticGaussian (LQG) Design of Servo Controller with Integral Action.
These topics focus on the continuoustime case. For information about discretetime LQG
design, see the dlqr
and kalman
reference pages.
You can design an LQG regulator to regulate the output y around zero in the following model.
The plant in this model experiences disturbances (process noise) w and is driven by controls u. The regulator relies on the noisy measurements y to generate these controls. The plant state and measurement equations take the form of
$$\begin{array}{l}\dot{x}=Ax+Bu+Gw\\ y=Cx+Du+Hw+v\end{array}$$
and both w and v are modeled as white noise.
Note
LQG design requires a statespace model of the plant. You can use ss
to convert other model formats to state space.
To design LQG regulators, you can use the design techniques shown in the following table.
To design an LQG regulator using...  Use the following commands: 

A quick, onestep design technique when the following is true:
 lqg 
A more flexible, threestep design technique that allows you to specify:

For more information, see

You construct the LQoptimal gain from the following elements:
To construct the optimal gain, type the following command:
K= lqr(A,B,Q,R,N)
This command computes the optimal gain matrix K
, for which the
state feedback law $$u=Kx$$ minimizes the following quadratic cost function for continuous time:
$$J(u)={\displaystyle {\int}_{0}^{\infty}\{{x}^{T}Qx+2{x}^{T}Nu+{u}^{T}Ru\}dt}$$
The software computes the gain matrix K by solving an algebraic Riccati equation.
For information about constructing LQoptimal gain, including the cost function that
the software minimizes for discrete time, see the lqr
reference page.
You need a Kalman state estimator for LQG regulation and servo control because you cannot implement optimal LQoptimal state feedback without full state measurement.
You construct the state estimate $$\widehat{x}$$ such that $$u=K\widehat{x}$$ remains optimal for the outputfeedback problem. You construct the Kalman state estimator gain from the following elements:
Note
You construct the Kalman state estimator in the same way for both regulation and servo control.
To construct the Kalman state estimator, type the following command:
[kest,L,P] = kalman(sys,Qn,Rn,Nn);
This command computes a Kalman state estimator, kest
with the
following plant equations:
$$\begin{array}{l}\dot{x}=Ax+Bu+Gw\\ y=Cx+Du+Hw+v\end{array}$$
where w and v are modeled as
white noise. L
is the Kalman gain and P
the
covariance matrix.
The software generates this state estimate using the Kalman filter
$$\frac{d}{dt}\widehat{x}=A\widehat{x}+Bu+L(yC\widehat{x}Du)$$
with inputs u (controls) and y (measurements). The noise covariance data
$$E(w{w}^{T})={Q}_{n},\text{\hspace{1em}}E(v{v}^{T})={R}_{n},\text{\hspace{1em}}E(w{v}^{T})={N}_{n}$$
determines the Kalman gain L through an algebraic Riccati equation.
The Kalman filter is an optimal estimator when dealing with Gaussian white noise.
Specifically, it minimizes the asymptotic covariance
$$\text{}\underset{t\to \infty}{\mathrm{lim}}$$$$E\left(\left(x\widehat{x}\right){\left(x\widehat{x}\right)}^{T}\right)$$
of the estimation error $$x\widehat{x}$$.
For more information, see the kalman
reference page. For a complete example of a Kalman filter
implementation, see Kalman
Filtering.
To form the LQG regulator, connect the Kalman filter kest
and LQoptimal gain K
by typing the following
command:
regulator = lqgreg(kest, K);
The regulator has the following statespace equations:
$$\begin{array}{l}\frac{d}{dt}\widehat{x}=[ALC(BLD)K]\widehat{x}+Ly\\ u=K\widehat{x}\end{array}$$
For more information on forming LQG regulators, see lqgreg
and LQG Regulation: Rolling Mill Case Study.
You can design a servo controller with integral action for the following model:
The servo controller you design ensures that the output y tracks the reference command r while rejecting process disturbances w and measurement noise v.
The plant in the previous figure is subject to disturbances w and is driven by controls u. The servo controller relies on the noisy measurements y to generate these controls. The plant state and measurement equations are of the form
$$\begin{array}{l}\dot{x}=Ax+Bu+Gw\\ y=Cx+Du+Hw+v\end{array}$$
and both w and v are modeled as white noise.
Note
LQG design requires a statespace model of the plant. You can use ss
to convert other model formats to state space.
To design LQG servo controllers, you can use the design techniques shown in the following table.
To design an LQG servo controller using...  Use the following commands: 

A quick, onestep design technique when the following is true:
 lqg 
A more flexible, threestep design technique that allows you to specify:

For more information, see

You construct the LQoptimal gain from the
Statespace plant model sys
Weighting matrices Q
, R
, and
N
, which define the tradeoff between tracker performance and
control effort
To construct the optimal gain, type the following command:
K= lqi(sys,Q,R,N)
This command computes the optimal gain matrix K
, for which the
state feedback law $$u=Kz=K[x;{x}_{i}]$$ minimizes the following quadratic cost function for continuous time:
$$J(u)={\displaystyle {\int}_{0}^{\infty}\left\{{z}^{T}Qz+{u}^{T}Ru+2{z}^{T}Nu\right\}dt}$$
The software computes the gain matrix K by solving an algebraic Riccati equation.
For information about constructing LQoptimal gain, including the cost function that
the software minimizes for discrete time, see the lqi
reference page.
You need a Kalman state estimator for LQG regulation and servo control because you cannot implement LQoptimal state feedback without full state measurement.
You construct the state estimate $$\widehat{x}$$ such that $$u=K\widehat{x}$$ remains optimal for the outputfeedback problem. You construct the Kalman state estimator gain from the following elements:
Note
You construct the Kalman state estimator in the same way for both regulation and servo control.
To construct the Kalman state estimator, type the following command:
[kest,L,P] = kalman(sys,Qn,Rn,Nn);
This command computes a Kalman state estimator, kest
with the
following plant equations:
$$\begin{array}{l}\dot{x}=Ax+Bu+Gw\\ y=Cx+Du+Hw+v\end{array}$$
where w and v are modeled as
white noise. L
is the Kalman gain and P
the
covariance matrix.
The software generates this state estimate using the Kalman filter
$$\frac{d}{dt}\widehat{x}=A\widehat{x}+Bu+L(yC\widehat{x}Du)$$
with inputs u (controls) and y (measurements). The noise covariance data
$$E(w{w}^{T})={Q}_{n},\text{\hspace{1em}}E(v{v}^{T})={R}_{n},\text{\hspace{1em}}E(w{v}^{T})={N}_{n}$$
determines the Kalman gain L through an algebraic Riccati equation.
The Kalman filter is an optimal estimator when dealing with Gaussian white noise.
Specifically, it minimizes the asymptotic covariance
$$\text{}\underset{t\to \infty}{\mathrm{lim}}$$$$E\left(\left(x\widehat{x}\right){\left(x\widehat{x}\right)}^{T}\right)$$
of the estimation error $$x\widehat{x}$$.
For more information, see the kalman
reference page. For a complete example of a Kalman filter
implementation, see Kalman
Filtering.
To form a twodegreeoffreedom LQG servo controller, connect the Kalman filter
kest
and LQoptimal gain K
by typing the following
command:
servocontroller = lqgtrack(kest, K);
The servo controller has the following statespace equations:
$$\begin{array}{l}\left[\begin{array}{c}\dot{\widehat{x}}\\ {\dot{x}}_{i}\end{array}\right]=\left[\begin{array}{cc}AB{K}_{x}LC+LD{K}_{x}& B{K}_{i}+LD{K}_{i}\\ 0& 0\end{array}\right]\left[\begin{array}{c}\widehat{x}\\ {x}_{i}\end{array}\right]+\left[\begin{array}{cc}0& L\\ I& I\end{array}\right]\left[\begin{array}{c}r\\ y\end{array}\right]\\ u=\left[\begin{array}{cc}{K}_{x}& {K}_{i}\end{array}\right]\left[\begin{array}{c}\widehat{x}\\ {x}_{i}\end{array}\right]\end{array}$$
For more information on forming LQG servo controllers, including how to form a
onedegreeoffreedom LQG servo controller, see the lqgtrack
reference page.
kalman
 lqg
 lqgreg
 lqgtrack
 lqi
 lqr