comparison scripts/control/hinf_ctr.m @ 3381:69b167451491

[project @ 1999-12-15 20:48:10 by jwe]
author jwe
date Wed, 15 Dec 1999 20:48:45 +0000
parents 8dd4718801fd
children 10f21f7ccc7f
comparison
equal deleted inserted replaced
3380:f5edd74bdc6c 3381:69b167451491
1 # Copyright (C) 1996 Auburn University. All Rights Reserved 1 ## Copyright (C) 1996 Auburn University. All Rights Reserved
2 # 2 ##
3 # This file is part of Octave. 3 ## This file is part of Octave.
4 # 4 ##
5 # Octave is free software; you can redistribute it and/or modify it 5 ## Octave is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the 6 ## under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 2, or (at your option) any 7 ## Free Software Foundation; either version 2, or (at your option) any
8 # later version. 8 ## later version.
9 # 9 ##
10 # Octave is distributed in the hope that it will be useful, but WITHOUT 10 ## Octave is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details. 13 ## for more details.
14 # 14 ##
15 # You should have received a copy of the GNU General Public License 15 ## You should have received a copy of the GNU General Public License
16 # along with Octave; see the file COPYING. If not, write to the Free 16 ## along with Octave; see the file COPYING. If not, write to the Free
17 # Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. 17 ## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File } {@var{K} =} hinf_ctr(@var{dgs}, @var{F}, @var{H}, @var{Z}, @var{g}) 20 ## @deftypefn {Function File } {@var{K} =} hinf_ctr(@var{dgs}, @var{F}, @var{H}, @var{Z}, @var{g})
21 ## Called by @code{hinfsyn} to compute the H_inf optimal controller. 21 ## Called by @code{hinfsyn} to compute the H_inf optimal controller.
22 ## 22 ##
34 ## 34 ##
35 ## Do not attempt to use this at home; no argument checking performed. 35 ## Do not attempt to use this at home; no argument checking performed.
36 ## @end deftypefn 36 ## @end deftypefn
37 37
38 function K = hinf_ctr(dgs,F,H,Z,g) 38 function K = hinf_ctr(dgs,F,H,Z,g)
39 # A. S. Hodel August 1995 39
40 # Revised by Kai P Mueller April 1998 to solve the general H_infinity 40 ## A. S. Hodel August 1995
41 # problem using unitary transformations Q (on w and z) 41 ## Revised by Kai P Mueller April 1998 to solve the general H_infinity
42 # and non-singular transformations R (on u and y). 42 ## problem using unitary transformations Q (on w and z)
43 ## and non-singular transformations R (on u and y).
43 44
44 nw = dgs.nw; 45 nw = dgs.nw;
45 nu = dgs.nu; 46 nu = dgs.nu;
46 nz = dgs.nz; 47 nz = dgs.nz;
47 ny = dgs.ny; 48 ny = dgs.ny;
69 F2 = F((nw+1):nin,:); 70 F2 = F((nw+1):nin,:);
70 H11 = H(:,1:(nz-nu)); 71 H11 = H(:,1:(nz-nu));
71 H12 = H(:,(nz-nu+1):nz); 72 H12 = H(:,(nz-nu+1):nz);
72 H2 = H(:,(nz+1):nout); 73 H2 = H(:,(nz+1):nout);
73 74
74 # D11 partitions 75 ## D11 partitions
75 D1111 = D11(1:(nz-nu),1:(nw-ny)); 76 D1111 = D11(1:(nz-nu),1:(nw-ny));
76 D1112 = D11(1:(nz-nu),(nw-ny+1):nw); 77 D1112 = D11(1:(nz-nu),(nw-ny+1):nw);
77 D1121 = D11((nz-nu+1):nz,1:(nw-ny)); 78 D1121 = D11((nz-nu+1):nz,1:(nw-ny));
78 D1122 = D11((nz-nu+1):nz,(nw-ny+1):nw); 79 D1122 = D11((nz-nu+1):nz,(nw-ny+1):nw);
79 80
80 # D11ik may be the empty matrix, don't calculate with empty matrices 81 ## D11ik may be the empty matrix, don't calculate with empty matrices
81 [nd1111,md1111] = size(D1111); 82 [nd1111,md1111] = size(D1111);
82 md1112 = length(D1112); 83 md1112 = length(D1112);
83 md1121 = length(D1121); 84 md1121 = length(D1121);
84 85
85 if ((nd1111 == 0) || (md1112 == 0)) 86 if ((nd1111 == 0) || (md1112 == 0))
111 c2hat = -d21hat*(C2+F12)*Z; 112 c2hat = -d21hat*(C2+F12)*Z;
112 b1hat = -H2 + (b2hat/d12hat)*d11hat; 113 b1hat = -H2 + (b2hat/d12hat)*d11hat;
113 c1hat = F2*Z + (d11hat/d21hat)*c2hat; 114 c1hat = F2*Z + (d11hat/d21hat)*c2hat;
114 ahat = A + H*C + (b2hat/d12hat)*c1hat; 115 ahat = A + H*C + (b2hat/d12hat)*c1hat;
115 116
116 # rescale controller by Ru and Ry 117 ## rescale controller by Ru and Ry
117 b1hat = b1hat/Ry; 118 b1hat = b1hat/Ry;
118 c1hat = Ru\c1hat; 119 c1hat = Ru\c1hat;
119 bhat = [b1hat, b2hat]; 120 bhat = [b1hat, b2hat];
120 chat = [c1hat; c2hat]; 121 chat = [c1hat; c2hat];
121 dhat = [Ru\d11hat/Ry, Ru\d12hat; d21hat/Ry, 0*d11hat']; 122 dhat = [Ru\d11hat/Ry, Ru\d12hat; d21hat/Ry, 0*d11hat'];
122 123
123 # non-zero D22 is a special case 124 ## non-zero D22 is a special case
124 if (d22nz) 125 if (d22nz)
125 if (rank(eye(nu) + d11hat*D22) < nu) 126 if (rank(eye(nu) + d11hat*D22) < nu)
126 error(" *** cannot compute controller for D22 non-zero."); 127 error(" *** cannot compute controller for D22 non-zero.");
127 endif 128 endif
128 129