~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/control/lqr.cat

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
lqr              Scilab Group              Scilab Function              lqr
 
2
NAME
 
3
   lqr - LQ compensator (full state)
 
4
  
 
5
CALLING SEQUENCE
 
6
 [K,X]=lqr(P12)
 
7
PARAMETERS
 
8
 P12        : syslin list (state-space linear system)
 
9
            
 
10
 K,X        : two real matrices
 
11
            
 
12
DESCRIPTION
 
13
   lqr  computes the linear optimal LQ full-state gain for the plant
 
14
  P12=[A,B2,C1,D12] in continuous or discrete time.
 
15
  
 
16
   P12 is a syslin list (e.g. P12=syslin('c',A,B2,C1,D12)).
 
17
  
 
18
   The cost function is l2-norm of z'*z with z=C1 x + D12 u i.e. [x,u]' *
 
19
  BigQ * [x;u] where
 
20
  
 
21
       [C1' ]               [Q  S]
 
22
 BigQ= [    ]  * [C1 D12] = [    ]
 
23
       [D12']               [S' R]
 
24
   The gain K is such that A + B2*K is stable.
 
25
  
 
26
   X is the stabilizing solution of the Riccati equation.
 
27
  
 
28
    For a continuous plant:
 
29
  
 
30
 (A-B2*inv(R)*S')'*X+X*(A-B2*inv(R)*S')-X*B2*inv(R)*B2'*X+Q-S*inv(R)*S'=0
 
31
 K=-inv(R)*(B2'*X+S)
 
32
   For a discrete plant:
 
33
  
 
34
 X=A'*X*A-(A'*X*B2+C1'*D12)*pinv(B2'*X*B2+D12'*D12)*(B2'*X*A+D12'*C1)+C1'*C1;
 
35
 K=-pinv(B2'*X*B2+D12'*D12)*(B2'*X*A+D12'*C1)
 
36
   An equivalent form for X is
 
37
  
 
38
 X=Abar'*inv(inv(X)+B2*inv(r)*B2')*Abar+Qbar
 
39
   with Abar=A-B2*inv(R)*S' and Qbar=Q-S*inv(R)*S' 
 
40
  
 
41
   The 3-blocks matrix pencils associated with these Riccati equations are:
 
42
  
 
43
                discrete                           continuous
 
44
    |I   0    0|   | A    0    B2|         |I   0   0|   | A    0    B2|
 
45
   z|0   A'   0| - |-Q    I    -S|        s|0   I   0| - |-Q   -A'   -S|
 
46
    |0   B2'  0|   | S'   0     R|         |0   0   0|   | S'  -B2'   R|
 
47
   Caution: It is assumed that matrix R is non singular. In particular, the
 
48
  plant must be tall (number of outputs >= number of inputs).
 
49
  
 
50
EXAMPLE
 
51
 A=rand(2,2);B=rand(2,1);   //two states, one input
 
52
 Q=diag([2,5]);R=2;     //Usual notations x'Qx + u'Ru
 
53
 Big=sysdiag(Q,R);    //Now we calculate C1 and D12
 
54
 [w,wp]=fullrf(Big);C1=w(:,1:2);D12=w(:,3);   //[C1,D12]'*[C1,D12]=Big
 
55
 P=syslin('c',A,B,C1,D12);    //The plant (continuous-time)
 
56
 [K,X]=lqr(P)
 
57
 spec(A+B*K)    //check stability
 
58
 norm(A'*X+X*A-X*B*inv(R)*B'*X+Q,1)  //Riccati check
 
59
 P=syslin('d',A,B,C1,D12);    // Discrete time plant
 
60
 [K,X]=lqr(P)     
 
61
 spec(A+B*K)   //check stability
 
62
 norm(A'*X*A-(A'*X*B)*pinv(B'*X*B+R)*(B'*X*A)+Q-X,1) //Riccati check
 
63
SEE ALSO
 
64
   lqe, gcare, leqr
 
65
  
 
66
AUTHOR
 
67
   F.D. 
 
68