home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS2.DI$ / HINFFI_G.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.9 KB  |  79 lines

  1. %    [xinf,f,fail,hamx,hxmin] = hinffi_g(p,ncon,epp,gam,imethd);
  2. %
  3. %    solve the hamiltonian for xinf for the FULL 
  4. %       INFORMATION feedback case.
  5.  
  6. function [xinf,f,fail,hamx,hxmin] = hinffi_g(p,ncon,epp,gam,imethd);
  7.  
  8. [a,bp,cp,dp,b1,b2,c1,d11,d12,ndata] = hinffi_p(p,ncon);
  9.  fail = 0;
  10.  np = max(size(a)); 
  11.  np1 = ndata(1);
  12.  np2 = ndata(2);
  13.  nm1 = ndata(3);
  14.  nm2 = ndata(4);
  15. %
  16. %  form r and rbar
  17. %
  18.  d1dot = [d11,d12];
  19.  r = zeros(nm1+nm2,nm1+nm2);
  20.  r(1:nm1,1:nm1) = -gam*gam*eye(nm1);
  21.  r = r+d1dot'*d1dot;
  22. %
  23. % form hamiltonian hamx for xinf
  24. %
  25.  dum = ([bp;-c1'*d1dot]/r)*[d1dot'*c1,bp'];
  26.  hamx = [a,0*a;-c1'*c1,-a']-dum;
  27.  if imethd == 1
  28. %
  29. % solve the Riccati equation using eigenvalue decomposition
  30.    [x1,x2,fail,hxmin] = ric_eig(hamx,epp);
  31.    if fail == 1,
  32. %     fprintf(' ric(x) has jw axis eigs   \n');
  33.      xinf = [];
  34.    else
  35. % really should check the condition number of x1 before doing this
  36. %  but the MATLAB 'cond' command has problems
  37.      xinf = real(x2/x1);
  38. %     if max(eig(xinf)) == Inf | min(eig(xinf)) == -Inf
  39.      if any(any(~finite(xinf)))
  40.        fail = 1;
  41.        xinf = [];  
  42.      end
  43.    end
  44.  elseif imethd == 2
  45. %
  46. % solve the Riccati equation using real schur decomposition
  47. %
  48.    [x1,x2,fail,hxmin] = ric_schr(hamx,epp);
  49.     if fail == 1 | fail == 3
  50. %      fprintf(' ric(x) has jw axis eigs   \n ');
  51.      fail = 1;
  52.     elseif fail == 2 
  53. %     fprintf(' ric(x) unequal number of pos and neg eigenvalues')
  54.      fail = 1;
  55.     else
  56.      xinf = real(x2/x1);
  57. %     if max(eig(xinf)) == Inf | min(eig(xinf)) == -Inf
  58.      if any(any(~finite(xinf)))
  59.        fail = 1;
  60.        xinf = [];  
  61.      end
  62.    end
  63. else
  64.    error('type of solution method is invalid')
  65.    return
  66. end
  67. %
  68. %  form f  submatrices
  69. %
  70.  if fail == 1
  71.    f = [];
  72.  else
  73.    f = -r\(d1dot'*c1+bp'*xinf);
  74.  end
  75.  
  76. %
  77. % Copyright MUSYN INC 1991,  All Rights Reserved
  78.