home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts / control / hinfsyn_chk.m < prev    next >
Text File  |  1999-03-05  |  3KB  |  88 lines

  1. # Copyright (C) 1996 A. Scottedward Hodel 
  2. #
  3. # This file is part of Octave. 
  4. #
  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 
  7. # Free Software Foundation; either version 2, or (at your option) any 
  8. # later version. 
  9. # Octave is distributed in the hope that it will be useful, but WITHOUT 
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  11. # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
  12. # for more details.
  13. # You should have received a copy of the GNU General Public License 
  14. # along with Octave; see the file COPYING.  If not, write to the Free 
  15. # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  16.  
  17. function [retval,Pc,Pf] = hinfsyn_chk(A,B1,B2,C1,C2,D12,D21,g,ptol)
  18.   # [retval,Pc,Pf] = hinfsyn_chk(A,B1,B2,C1,C2,D12,D21,g,ptol)
  19.   #
  20.   # Called by hinfsyn to see if gain g satisfies conditions in Theorem 3 of
  21.   # Doyle, Glover, Khargonekar, Francis, "State Space Solutions to Standard
  22.   # H2 and Hinf Control Problems", IEEE TAC August 1989
  23.   # 
  24.   # inputs:
  25.   #   g = candidate gain level
  26.   #   ptol: as in hinfsyn
  27.   #   remaining parameters as returned by is_dgkf
  28.   # outputs: 
  29.   #   retval: = 1 if g exceeds optimal Hinf closed loop gain, else 0
  30.   #   Pc: solution of "regulator" H-inf ARE
  31.   #   Pf: solution of "filter" H-inf ARE
  32.   #
  33.   # Do not attempt to use this at home; no argument checking performed.
  34.  
  35.   # A. S. Hodel August 1995
  36.  
  37.   Pc = Pf = [];
  38.  
  39.   # Construct the two Hamiltonians
  40.   g2 = 1/(g*g);
  41.   Hc = [ A ,  g2*B1*B1' - B2*B2'; -C1'*C1 , -A'];
  42.   Hf = [ A' , g2*C1'*C1 - C2'*C2; -B1*B1' , -A];
  43.  
  44.   # check if Hc, Hf are in dom(Ric)
  45.   Hcminval = min(abs(real(eig(Hc))));
  46.   Hfminval = min(abs(real(eig(Hf))));
  47.   if(Hcminval < ptol);
  48.     disp("hinfsyn_chk: Hc is not in dom(Ric)");
  49.     retval = 0;
  50.     return
  51.   endif
  52.   if(Hfminval < ptol)
  53.     disp("hinfsyn_chk: Hf is not in dom(Ric)");
  54.     retval = 0;
  55.     return
  56.   endif
  57.  
  58.   #Solve ARE's
  59.   Pc = are(A, B2*B2'-g2*B1*B1',C1'*C1);
  60.   Pf = are(A',C2'*C2-g2*C1'*C1,B1*B1');
  61.  
  62.   Pceig = eig(Pc);
  63.   Pfeig = eig(Pf);
  64.   Pcfeig = eig(Pc*Pf);
  65.  
  66.   if(min(Pceig) < -ptol)
  67.     disp("hinfsyn_chk: Pc is not >= 0");
  68.     retval = 0;
  69.     return
  70.   endif
  71.   if(min(Pfeig) < -ptol)
  72.     disp("hinfsyn_chk: Pf is not >= 0");
  73.     retval = 0;
  74.     return
  75.   endif
  76.   if(max(abs(Pcfeig)) >= g*g)
  77.     disp("hinfsyn_chk: rho(Pf*Pc) is not < g^2");
  78.     retval = 0;
  79.     return
  80.   endif
  81.  
  82.   # all conditions met.
  83.   retval = 1;
  84.  
  85. endfunction
  86.