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

  1. % function out = h2norm(sys)
  2. %
  3. %   Calculates the 2-norm of a stable, strictly
  4. %   proper SYSTEM matrix. H2NORM solves a Lyapunov equation
  5. %   with SYLV to get the controllability grammian.
  6. %
  7. %   See also: H2SYN, HINFSYN, HINFFI, and HINFNORM.
  8.  
  9. function out = h2norm(sys)
  10.  if nargin ~= 1
  11.    disp('usage: out = h2norm(sys)')
  12.    return
  13.  end
  14.  [mtype,mrows,mcols,mnum] = minfo(sys);
  15.  if mtype == 'syst'
  16.    if mnum == 0
  17.      disp('system has no states')
  18.      return
  19.    else
  20.      [a,b,c,d] = unpck(sys);
  21.      if norm(d,'fro') ~= 0
  22.        disp(['nonzero D term gives INFINITE 2 norm'])
  23.        return
  24.      elseif max(real(eig(a))) >= 0
  25.        disp(['system has poles in closed right-half plane'])
  26.        return
  27.      else
  28.        p = sylv(a,a',-b*b');
  29.        tnorm = sqrt(sum(diag(c*p*c')));
  30.      end
  31.      if nargout == 1
  32.        out = tnorm; 
  33.      else
  34.        fprintf(' %.3e \n',tnorm)
  35.      end
  36.    end
  37.  else
  38.    error('input matrix is not a SYSTEM matrix')
  39.    return
  40.  end
  41. %
  42. % Copyright MUSYN INC 1991,  All Rights Reserved
  43.