LQRContinuous - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

ControlDesign

 LQRContinuous
 design continuous-time linear quadratic state feedback regulator (LQR) for a given pair

 Calling Sequence LQRContinuous(A, B, Q, R, opts)

Parameters

 A - Matrix; system matrix of a state-space system B - Matrix or Vector; input matrix of a state-space system Q - Matrix; state weighting matrix R - Matrix; input weighting matrix opts - (optional) equation(s) of the form option = value; specify options for the LQRContinuous command

Options

 • N = Matrix or Vector

Weighting on the state-input multiplication term in the cost function. If omitted, a zero matrix with appropriate dimensions will be considered.

 • poles   = true or false True means the eigenvalues of A-BK are returned. See LQR for details. The default value is false.
 • riccati  =  true or false True means the solution of the associated Riccati equation is returned. The infinite horizon solution of the following continuous-time Riccati equation (CARE) is returned.

${A}^{T}X+\mathrm{XA}-\left(\mathrm{XB}+N\right){R}^{-1}{\left(\mathrm{XB}+N\right)}^{T}+Q=0$

The LQR feedback gain is calculated as

$K={R}^{-1}{\left(\mathrm{XB}+N\right)}^{T}$

The default value is false.

 • parameters = {list, set}(name = complexcons)
 Specifies numeric values for the parameters of sys. These values override any parameters previously specified for sys. The numeric value on the right-hand side of each equation is substituted for the name on the left-hand side in the sys equations. The default is the value of sys given by DynamicSystems:-SystemOptions(parameters).

Solvability Conditions

 • The pair $\left(A,B\right)$ must be stabilizable.
 • The pair $\left(Q-N{R}^{-1}{N}^{T},A-B{R}^{-1}{N}^{T}\right)$ must have no unobservable modes on the imaginary axis.
 • $R>0$ (positive definite) and $Q-N{R}^{-1}{N}^{T}\ge 0$ (positive semidefinite).

Description

 • The LQRContinuous command calculates the LQR state feedback gain for a given pair.
 • The optimal state feedback gain, $K$, is calculated such that the quadratic cost function

$J\left(u\right)={\int }_{0}^{\infty }\left({x}^{T}\mathrm{Qx}+{u}^{T}\mathrm{Ru}+2{x}^{T}\mathrm{Νu}\right)ⅆt$

is minimized by the feedback law u = -Kx subject to the system dynamics

$\stackrel{·}{x}=\mathrm{Ax}+\mathrm{Bu}$

 • Q and R are expected to be symmetric. If the input Q and/or R are not symmetric, their symmetric part will be considered since their antisymmetric (skew-symmetric) part has no role in the quadratic cost function.
 • In addition to the state feedback gain, depending on the corresponding option values, the command also returns the closed-loop eigenvalues and the solution of the associated Riccati equation.
 • Note that the time domain is inherent to the command regardless of the any time domain implications the input pair might have. To be more specific, this command calculates a continuous-time LQR feedback gain for the given input pair even if that pair is initially extracted from a discrete-time state-space.  If the gain is then used for feedback stabilization in discrete time domain, obviously such a mistake in command usage leads to a result which is not theoretically valid.

Examples

 > $\mathrm{with}\left(\mathrm{ControlDesign}\right):$
 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$
 > $\mathrm{csys}≔\mathrm{NewSystem}\left(\mathrm{Matrix}\left(\left[\left[\frac{2}{{s}^{2}+3s+1},\frac{1}{s+2}\right],\left[\frac{s-1}{{s}^{2}+5},\frac{7}{\left(s+1\right)\left(s+4\right)}\right]\right]\right)\right)$
 ${\mathrm{csys}}{≔}\left[\begin{array}{c}{\mathbf{Transfer Function}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 2 input\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({s}\right){,}{\mathrm{u2}}{}\left({s}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({s}\right){,}{\mathrm{y2}}{}\left({s}\right)\right]\end{array}\right$ (1)
 > $\mathrm{sys}≔\mathrm{StateSpace}\left(\mathrm{csys}\right)$
 ${\mathrm{sys}}{≔}\left[\begin{array}{c}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 2 input\left(s\right); 7 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right){,}{\mathrm{x5}}{}\left({t}\right){,}{\mathrm{x6}}{}\left({t}\right){,}{\mathrm{x7}}{}\left({t}\right)\right]\end{array}\right$ (2)
 > $\mathrm{sys}:-a;$$\mathrm{sys}:-b;$$\mathrm{sys}:-c;$$\mathrm{sys}:-d$
 $\left[\begin{array}{ccccccc}{0}& {1}& {0}& {0}& {0}& {0}& {0}\\ {0}& {0}& {1}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {1}& {0}& {0}& {0}\\ {-5}& {-15}& {-6}& {-3}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}& {1}& {0}\\ {0}& {0}& {0}& {0}& {0}& {0}& {1}\\ {0}& {0}& {0}& {0}& {-8}& {-14}& {-7}\end{array}\right]$
 $\left[\begin{array}{cc}{0}& {0}\\ {0}& {0}\\ {0}& {0}\\ {1}& {0}\\ {0}& {0}\\ {0}& {0}\\ {0}& {1}\end{array}\right]$
 $\left[\begin{array}{ccccccc}{10}& {0}& {2}& {0}& {4}& {5}& {1}\\ {-1}& {-2}& {2}& {1}& {14}& {7}& {0}\end{array}\right]$
 $\left[\begin{array}{cc}{0}& {0}\\ {0}& {0}\end{array}\right]$ (3)
 > $Q≔\frac{1}{3}\mathrm{LinearAlgebra}:-\mathrm{IdentityMatrix}\left(7\right);$$R≔2\mathrm{LinearAlgebra}:-\mathrm{IdentityMatrix}\left(2\right)$
 ${Q}{≔}\left[\begin{array}{ccccccc}\frac{{1}}{{3}}& {0}& {0}& {0}& {0}& {0}& {0}\\ {0}& \frac{{1}}{{3}}& {0}& {0}& {0}& {0}& {0}\\ {0}& {0}& \frac{{1}}{{3}}& {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& \frac{{1}}{{3}}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}& \frac{{1}}{{3}}& {0}& {0}\\ {0}& {0}& {0}& {0}& {0}& \frac{{1}}{{3}}& {0}\\ {0}& {0}& {0}& {0}& {0}& {0}& \frac{{1}}{{3}}\end{array}\right]$
 ${R}{≔}\left[\begin{array}{cc}{2}& {0}\\ {0}& {2}\end{array}\right]$ (4)
 > $K≔\mathrm{LQRContinuous}\left(\mathrm{sys}:-a,\mathrm{sys}:-b,Q,R\right)$
 ${K}{≔}\left[\begin{array}{ccccccc}{0.0166389810974705}& {0.299443675955044}& {0.867776452191478}& {0.301850931076329}& {0.}& {0.}& {0.}\\ {0.}& {0.}& {0.}& {0.}& {0.0104098937986105}& {0.0195439507289429}& {0.0146813589873455}\end{array}\right]$ (5)
 > $\mathrm{Kpr}≔\mathrm{LQRContinuous}\left(\mathrm{sys}:-a,\mathrm{sys}:-b,Q,R,\mathrm{poles}=\mathrm{true},\mathrm{riccati}=\mathrm{true}\right):$$\mathrm{Kpr}\left[1\right];$$\mathrm{Kpr}\left[2\right];$$\mathrm{Kpr}\left[3\right]$
 $\left[\begin{array}{ccccccc}{0.0166389810974705}& {0.299443675955044}& {0.867776452191478}& {0.301850931076329}& {0.}& {0.}& {0.}\\ {0.}& {0.}& {0.}& {0.}& {0.0104098937986105}& {0.0195439507289429}& {0.0146813589873455}\end{array}\right]$
 $\left[\begin{array}{c}{-2.62756665299744}{+}{0.}{}{I}\\ {-0.145624709217511}{+}{2.22784297750641}{}{I}\\ {-0.145624709217511}{-}{2.22784297750641}{}{I}\\ {-0.383034859643869}{+}{0.}{}{I}\\ {-1.00185981437603}{+}{0.}{}{I}\\ {-1.98515367555330}{+}{0.}{}{I}\\ {-4.02766786905801}{+}{0.}{}{I}\end{array}\right]$
 $\left[\begin{array}{ccccccc}{3.5035710678024963642735698334738086970173092871078}& {8.9063101270541111531167581075671803104947792461458}& {3.1283881812209808268605882029451459276062782436105}& {0.033277962194940937420660323652668921352991539626009}& {0.}& {0.}& {0.}\\ {8.9063101270541111531167581075671803104947792461458}& {27.017929837486759850611800937425078242698100086181}& {10.999686730609094484906069375902437265430236365035}& {0.59888735191008724334359278295378054778377357379270}& {0.}& {0.}& {0.}\\ {3.1283881812209808268605882029451459276062782436105}& {10.999686730609094484906069375902437265430236365035}& {8.7538607942749524452688978919514869492958202135138}& {1.7355529043829555120085717535997438572353549848779}& {0.}& {0.}& {0.}\\ {0.033277962194940937420660323652668921352991539626009}& {0.59888735191008724334359278295378054778377357379270}& {1.7355529043829555120085717535997438572353549848779}& {0.60370186215265844164465469332087994051094168275939}& {0.}& {0.}& {0.}\\ {0.}& {0.}& {0.}& {0.}& {0.60458713892716850967689842079379231322521721813087}& {0.38094591975383059966396461879896053218176570663419}& {0.020819787597221039613645137137870970189590359262787}\\ {0.}& {0.}& {0.}& {0.}& {0.38094591975383059966396461879896053218176570663419}& {0.66444743776701954149815236150708781014928590795157}& {0.039087901457885851258326665942712298638987275213164}\\ {0.}& {0.}& {0.}& {0.}& {0.020819787597221039613645137137870970189590359262787}& {0.039087901457885851258326665942712298638987275213164}& {0.029362717974691029572229097828269653238134822396934}\end{array}\right]$ (6)