File: ricc.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (69 lines) | stat: -rw-r--r-- 1,983 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

RICC(G)                        Scilab Function                        RICC(G)
NAME
  ricc - Riccati equation

CALLING SEQUENCE
  [X]=ricc(A,B,C,"cont")
  [X]=ricc(F,G,H,"disc")

PARAMETERS

  A,B,C     : real matrices of appropriate dimensions

  F,G,H     : real matrices of appropriate dimensions

  X         : real matrix

  "cont","disc"' : imposed string (flag for continuous or discrete)

DESCRIPTION
  Riccati solver.

  Continuous time:
    X=ricc(A,B,C,'cont')
  gives a solution to the continuous time ARE
    A'*X+X*A-X*B*X+C=0 .
  B and C are assumed to be nonnegative definite.  (A,G) is assumed to be
  stabilizable with G*G' a full rank factorization of B.

  (A,H) is assumed to be detectable with H*H' a full rank factorization of C.
  Discrete time:
    X=ricc(F,G,H,'disc')
  gives a solution  to the discrete time ARE
    X=F'*X*F-F'*X*G1*((G2+G1'*X*G1)^-1)*G1'*X*F+H
  F is assumed invertible and   G = G1*inv(G2)*G1'.

  One  assumes  (F,G1) stabilizable and (C,F) detectable with C'*C full rank
  factorization of H. Use preferably ric_desc.

EXAMPLE
  //Standard formulas to compute Riccati solutions
  A=rand(3,3);B=rand(3,2);C=rand(3,3);C=C*C';R=rand(2,2);R=R*R'+eye;B=B*inv(R)*B';
  X=ricc(A,B,C,'cont');
  norm(A'*X+X*A-X*B*X+C,1)
  H=[A -B;-C -A'];
  [T,d]=gschur(eye(H),H,'cont');T=T(:,1:d);
  X1=T(4:6,:)/T(1:3,:);
  norm(X1-X,1)
  [T,d]=schur(H,'cont');T=T(:,1:d);
  X2=T(4:6,:)/T(1:3,:);
  norm(X2-X,1)
  //       Discrete time case
  F=A;B=rand(3,2);G1=B;G2=R;G=G1/G2*G1';H=C;
  X=ricc(F,G,H,'disc');
  norm(F'*X*F-(F'*X*G1/(G2+G1'*X*G1))*(G1'*X*F)+H-X)
  H1=[eye(3,3) G;zeros(3,3) F'];
  H2=[F zeros(3,3);-H eye(3,3)];
  [T,d]=gschur(H2,H1,'disc');T=T(:,1:d);X1=T(4:6,:)/T(1:3,:);
  norm(X1-X,1)
  Fi=inv(F);
  Hami=[Fi Fi*G;H*Fi F'+H*Fi*G];
  [T,d]=schur(Hami,'d');T=T(:,1:d);
  Fit=inv(F');
  Ham=[F+G*Fit*H -G*Fit;-Fit*H Fit];
  [T,d]=schur(Ham,'d');T=T(:,1:d);X2=T(4:6,:)/T(1:3,:);
  norm(X2-X,1)

SEE ALSO
  riccati, ric_desc, schur, gschur