- Manual Scilab
- CACSD
- black
- bode
- chart
- evans
- gainplot
- m_circle
- nyquist
- routh_t
- sgrid
- zgrid
- abcd
- abinv
- arhnk
- arl2
- arma
- arma2p
- armac
- armax
- armax1
- arsimul
- augment
- balreal
- bilin
- bstap
- cainv
- calfrq
- canon
- ccontrg
- cls2dls
- colinout
- colregul
- cont_frm
- cont_mat
- contr
- contrss
- copfac
- csim
- ctr_gram
- dbphi
- dcf
- ddp
- des2ss
- des2tf
- dhinf
- dhnorm
- dscr
- dsimul
- dt_ility
- dtsi
- equil
- equil1
- feedback
- findABCD
- findAC
- findBD
- findBDK
- findR
- findx0BD
- flts
- fourplan
- frep2tf
- freq
- freson
- fspecg
- fstabst
- g_margin
- gamitg
- gcare
- gfare
- gfrancis
- gtild
- h2norm
- h_cl
- h_inf
- h_inf_st
- h_norm
- hallchart
- hankelsv
- hinf
- imrep2ss
- inistate
- invsyslin
- kpure
- krac2
- lcf
- leqr
- lft
- lin
- linf
- linfn
- linmeq
- lqe
- lqg
- lqg2stan
- lqg_ltr
- lqr
- ltitr
- macglov
- markp2ss
- minreal
- minss
- mucomp
- narsimul
- nehari
- nicholschart
- noisegen
- obs_gram
- obscont
- observer
- obsv_mat
- obsvss
- p_margin
- parrot
- pfss
- phasemag
- ppol
- prbs_a
- projsl
- reglin
- repfreq
- ric_desc
- ricc
- riccati
- rowinout
- rowregul
- rtitr
- sensi
- show_margins
- sident
- sm2des
- sm2ss
- sorder
- specfact
- ss2des
- ss2ss
- ss2tf
- st_ility
- stabil
- svplot
- sysfact
- syssize
- tf2des
- tf2ss
- time_id
- trzeros
- ui_observer
- unobs
- zeropen
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
lqr
LQ compensator (full state)
Calling Sequence
[K,X]=lqr(P12)
Arguments
- P12
syslin
list (state-space linear system)- K,X
two real matrices
Description
lqr
computes the linear optimal LQ full-state gain
for the plant P12=[A,B2,C1,D12]
in continuous or
discrete time.
P12
is a syslin
list (e.g. P12=syslin('c',A,B2,C1,D12)
).
The cost function is l2-norm of z'*z
with z=C1 x + D12 u
i.e. [x,u]' * BigQ * [x;u]
where
[C1' ] [Q S] BigQ= [ ] * [C1 D12] = [ ] [D12'] [S' R]
The gain K
is such that A + B2*K
is stable.
X
is the stabilizing solution of the Riccati equation.
For a continuous plant:
K=-inv(R)*(B2'*X+S)
For a discrete plant:
X=A'*X*A-(A'*X*B2+C1'*D12)*pinv(B2'*X*B2+D12'*D12)*(B2'*X*A+D12'*C1)+C1'*C1;
K=-pinv(B2'*X*B2+D12'*D12)*(B2'*X*A+D12'*C1)
An equivalent form for X
is
with Abar=A-B2*inv(R)*S'
and Qbar=Q-S*inv(R)*S'
The 3-blocks matrix pencils associated with these Riccati equations are:
discrete continuous |I 0 0| | A 0 B2| |I 0 0| | A 0 B2| z|0 A' 0| - |-Q I -S| s|0 I 0| - |-Q -A' -S| |0 B2' 0| | S' 0 R| |0 0 0| | S' -B2' R|
Caution: It is assumed that matrix R is non singular. In particular, the plant must be tall (number of outputs >= number of inputs).
Examples
A=rand(2,2);B=rand(2,1); //two states, one input Q=diag([2,5]);R=2; //Usual notations x'Qx + u'Ru Big=sysdiag(Q,R); //Now we calculate C1 and D12 [w,wp]=fullrf(Big);C1=wp(:,1:2);D12=wp(:,3:$); //[C1,D12]'*[C1,D12]=Big P=syslin('c',A,B,C1,D12); //The plant (continuous-time) [K,X]=lqr(P) spec(A+B*K) //check stability norm(A'*X+X*A-X*B*inv(R)*B'*X+Q,1) //Riccati check P=syslin('d',A,B,C1,D12); // Discrete time plant [K,X]=lqr(P) spec(A+B*K) //check stability norm(A'*X*A-(A'*X*B)*pinv(B'*X*B+R)*(B'*X*A)+Q-X,1) //Riccati check
Authors
F.D.;
<< lqg_ltr | CACSD | ltitr >> |