ControlDesign
LQROutput
design linear quadratic state feedback regulator (LQR) with output weighting
Calling Sequence
Parameters
Options
Solvability Conditions
Description
Examples
LQROutput(sys, Q, R, opts)
sys
-
System; system object
Q
Matrix; output weighting matrix
R
Matrix; input weighting matrix
opts
(optional) equation(s) of the form option = value; specify options for the LQROutput command
N = Matrix or Vector
Weighting on the output-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 default value is false.
return_Kr = true or false True means the direct gain Kr is returned. 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).
The data A,B,⁢Q_,⁢R_,⁢N_ must satisfy the solvability conditions of the standard LQR problem described in the LQR help page.
The LQROutput command calculates the LQR state feedback gain for a system with output weighting.
The system sys is a continuous or discrete-time linear system object created using the DynamicSystems package. The system object must be in state-space (SS) form.
In continuous-time domain, the optimal state feedback gain, K, is calculated such that the quadratic cost-function
Ju=∫0∞yTQy+uTRu+2⁢yTΝu⁢ⅆt
is minimized by the feedback law u = -Kx subject to the following state-space
x·=Ax+Bu
y=Cx+Du
In discrete-time domain, the optimal state feedback gain, K, is calculated such that the quadratic cost-function
Ju=∑n=0∞yTQy+uTRu+2⁢yTΝu
is minimized by the feedback law u[n] = -Kx[n] subject to the following state-space
xn+1=Axn+Bun⁢⁢⁢⁢⁢⁢⁢
yn=Cxn+Dun
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 LQR with output weighting, the weighting matrix Q acts on the outputs rather than the states as in the standard LQR. Also, the weighing matrix N acts on the inner product of the outputs and inputs (creating a bilinear form) rather than the inner product of the states and inputs.
In addition to the state feedback gain, depending on the corresponding option values, the command returns the closed-loop eigenvalues and the solution of the associated Riccati equation.
The output weighting LQR problem is equivalent to the standard LQR problem with the following weighting matrices:
Q_=CTQC
R_=DTQD+N+NTD+R
N_=CTQD+N
The direct gain Kr is computed as follows:
C−D·K·1−A+B·K·B+D
C−D·K·1−A+I+B·K·B+D (discrete time)
If sys contains structured uncontrollable or unobservable states, they are removed using ReduceSystem before computing the LQR state feedback. The resulting gain K is then filled with zeros at positions corresponding to the removed states; however, the other outputs are not filled and, consequently, they may have lower dimensions as expected.
with⁡ControlDesign:
with⁡DynamicSystems:
csys≔NewSystem⁡Matrix⁡3s+2⁢s+7,1s+1,3⁢s−2s2+5,1s2+5⁢s+1
csys≔Transfer Functioncontinuous2 output(s); 2 input(s)inputvariable=u1⁡s,u2⁡soutputvariable=y1⁡s,y2⁡s
csys:-tf
3s2+9⁢s+141s+13⁢s−2s2+51s2+5⁢s+1
sys≔StateSpace⁡csys
sys≔State Spacecontinuous2 output(s); 2 input(s); 7 state(s)inputvariable=u1⁡t,u2⁡toutputvariable=y1⁡t,y2⁡tstatevariable=x1⁡t,x2⁡t,x3⁡t,x4⁡t,x5⁡t,x6⁡t,x7⁡t
sys:-a;sys:-b;sys:-c;sys:-d
010000000100000001000−70−45−19−9000000001000000010000−1−6−6
00000010000001
15030151−2824253110
0000
Q≔15⁢LinearAlgebra:-IdentityMatrix⁡2;R≔2⁢LinearAlgebra:-IdentityMatrix⁡2
Q≔150015
R≔2002
K≔LQROutput⁡sys,Q,R
K≔0.71703466815744314.24233926275838.973250402122570.992321630768280−0.01789144271597020.0116054056366964−0.00303834255501862−0.0317449620940457−0.565427777675089−0.0603711482280991−0.003038342555018620.09529899857415240.2984252458452400.0577917808525738
Kpr≔LQROutput⁡sys,Q,R,poles=true,riccati=true,return_Kr=true:Kpr1;Kpr2;Kpr3;Kpr4
0.71703466815744314.24233926275838.973250402122570.992321630768280−0.01789144271597020.0116054056366964−0.00303834255501862−0.0317449620940457−0.565427777675089−0.0603711482280991−0.003038342555018620.09529899857415240.2984252458452400.0577917808525738
−6.99856378303368+0.⁢I−4.79073410146030+0.⁢I−0.494228759193816+2.18968411573883⁢I−0.494228759193816−2.18968411573883⁢I−2.00557177848029+0.⁢I−1.04883795460928+0.⁢I−0.217948275649673+0.⁢I
2213.32101790119251056614903597299886356235231057771427.3744698955260840335662780084477714201028438168170.054903260978427885633257662450797110563540776981.4340693363148856210209140521689160116840515800739−8.1584867958664927190611477199891984007760389352564−3.8143338925075523792756023597033096286517352171425−0.0634899241880913820491764690309541509151427896382431427.37446989552608403356627800844777142010284381681314.4149489966517127605774990095472393845261805749358.1063827353889479110097065599029297325930670438328.484678525516698881224832846966240322944663907424−6.7332125306921498463443365378844628598517488954127−7.1469946052254660167289986202242491609016370025761−1.1308555553501777075201057104844140218420156581446170.05490326097842788563325766245079711056354077698358.10638273538894791100970655990292973259306704383173.5511184829945201990789415563781807942889617308417.946500804245141593919755909088874368587080074509−0.96420988722855540330309373855482549187031417311249−0.37056076992136628982081706414090368560463357756919−0.120742296456198253508795432334679555298369741690351.434069336314885621020914052168916011684051580073928.48467852551669888122483284696624032294466390742417.9465008042451415939197559090888743685870800745091.9846432615365601333495110097986200526978925133139−0.0357828854319403925390248349881317236941744240707440.023210811273392858470564369426083998560166901460873−0.0060766851100372365759906089897292226102991059271909−8.1584867958664927190611477199891984007760389352564−6.7332125306921498463443365378844628598517488954127−0.96420988722855540330309373855482549187031417311249−0.0357828854319403925390248349881317236941744240707440.596902453836612549593454762987320081129922419261371.07029526294066028705460631327280618439874299115450.19059799714830485098021287040917562854135390550258−3.8143338925075523792756023597033096286517352171425−7.1469946052254660167289986202242491609016370025761−0.370560769921366289820817064140903685604633577569190.0232108112733928584705643694260839985601669014608731.07029526294066028705460631327280618439874299115453.11842885364735590608559173893899972252920058178000.59685049169047937887974968854007127189693335562395−0.063489924188091382049176469030954150915142789638243−1.1308555553501777075201057104844140218420156581446−0.12074229645619825350879543233467955529836974169035−0.00607668511003723657599060898972922261029910592719090.190597997148304850980212870409175628541353905502580.596850491690479378879749688540071271896933355623950.11558356170514763732723892618907256020381429737325
1.63293195981652−1.650823402532490.7124796976274940.382819300946659
We can also use LQROuput with discrete models:
dsys≔ToDiscrete⁡csys,1,method=bilinear
dsys≔Transfer Functiondiscrete; sampletime = 12 output(s); 2 input(s)inputvariable=u1⁡z,u2⁡zoutputvariable=y1⁡z,y2⁡z
dsys:-tf
3⁢z+124⁢9⁢z+5⁢zz+13⁢z−134⁢z+1⁢z−29⁢z2+29⁢z+1z+1215⁢z2−25⁢z−13
sys≔StateSpace⁡dsys
sys≔State Spacediscrete; sampletime = 12 output(s); 2 input(s); 7 state(s)inputvariable=u1⁡q,u2⁡qoutputvariable=y1⁡q,y2⁡qstatevariable=x1⁡q,x2⁡q,x3⁡q,x4⁡q,x5⁡q,x6⁡q,x7⁡q
Q≔5⁢LinearAlgebra:-IdentityMatrix⁡2;R≔3⁢LinearAlgebra:-IdentityMatrix⁡2
Q≔5005
R≔3003
K≔0.00356160133647377−0.494191307766542−0.914892355689041−0.0264403506039962−0.00753844597397812−0.0102161879672920−0.002372351128087200.03007742174232820.0656631598525158−0.00165075351937600−0.0578915850030273−0.0812015931703188−0.08125490227687810.279310675111098
0.00356160133647377−0.494191307766542−0.914892355689041−0.0264403506039962−0.00753844597397812−0.0102161879672920−0.002372351128087200.03007742174232820.0656631598525158−0.00165075351937600−0.0578915850030273−0.0812015931703188−0.08125490227687810.279310675111098
0.767828122439180+0.⁢I0.146877156240930+0.⁢I−0.0598533454582572+0.309176357637630⁢I−0.0598533454582572−0.309176357637630⁢I−0.132589590854147+0.⁢I−0.554251178458362+0.⁢I−0.405472587458189+0.⁢I
0.0304211358227157466614831194656197507800796442265190.0659099074660814459436517252170818377316774848883810.0778639938919282025540123145365663168952319487223720.059112886634046876785210492949616537395421761897085−0.050188644413976545817420078367331778312895021111404−0.0624339422311989134570067174457702429138821687094310.146474409167257927641059579380656139496582643985180.0659099074660814459436517252170818377316774848883812.28477019723166846331403326445603696983752922740174.78473065161356356386017678923536749986041051670751.5200731282028195434731344834060459690437415027044−0.051381185070926621076018021910551508907205422423887−0.24248117228076022252788740320992280262529833198557−0.0180264651866313856169280255933313781299352734938210.0778639938919282025540123145365663168952319487223724.784730651613563563860176789235367499860410516707512.2175965875913100118031195237014211975844533348016.87145338284372248472282497087245857492745737283530.033219117439838470818425867947158666956219639899675−0.41757515631223804555176954389437678658213715588195−0.689897742178268626241699688484998807893682197828190.0591128866340468767852104929496165373954217618970851.52007312820281954347313448340604596904374150270446.87145338284372248472282497087245857492745737283537.7290189303281432825264402037496282033620051084464−0.00089785711277865282387993604941083466168087624032189−0.25047345435813408835915911397628042401730449430088−0.52414391617243365970614715171054243008109996218594−0.050188644413976545817420078367331778312895021111404−0.0513811850709266210760180219105515089072054224238870.033219117439838470818425867947158666956219639899675−0.000897857112778652823879936049410834661680876240321890.0963038091252386614415155578358141646605783019810600.10527321517532861157297605229965868726473800562174−0.30422873354722336756437043493817780506351359200722−0.062433942231198913457006717445770242913882168709431−0.24248117228076022252788740320992280262529833198557−0.41757515631223804555176954389437678658213715588195−0.250473454358134088359159113976280424017304494300880.105273215175328611572976052299658687264738005621740.15017244479508106184875357307589186761301102349660−0.279101552027404064051986259212816877521143037057940.14647440916725792764105957938065613949658264398518−0.018026465186631385616928025593331378129935273493821−0.68989774217826862624169968848499880789368219782819−0.52414391617243365970614715171054243008109996218594−0.30422873354722336756437043493817780506351359200722−0.279101552027404064051986259212816877521143037057941.0680116872765628785913505609708284332160101080345
0.879831651067362−0.9930459419638381.096222040127400.561082720692690
See Also
ControlDesign[LQR]
ControlDesign[LQRContinuous]
ControlDesign[LQRDiscrete]
ControlDesign[StateFeedback][Ackermann]
ControlDesign[StateFeedback][PolePlacement]
Download Help Document