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

  1. function [ab,bb,cb,m,T] = dbalreal(a,b,c)
  2. %DBALREAL  Discrete balanced state-space realization and model reduction.
  3. %    [Ab,Bb,Cb] = DBALREAL(A,B,C) returns a balanced state-space 
  4. %    realization of the system (A,B,C).
  5. %
  6. %    [Ab,Bb,Cb,M,T] = DBALREAL(A,B,C) also returns a vector M 
  7. %    containing the diagonal of the gramian of the balanced realization
  8. %    and matrix T, the similarity transformation used to convert 
  9. %    (A,B,C) to (Ab,Bb,Cb).  If the system (A,B,C) is normalized 
  10. %    properly, small elements in gramian M indicate states that can be
  11. %    removed to reduce the model to lower order.
  12. %
  13. %    See also DMODRED, BALREAL and MODRED.
  14.  
  15. %    J.N. Little 3-6-86
  16. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  17.  
  18. Gc = dgram(a,b);
  19. Go = dgram(a',c');
  20. R = chol(Gc);
  21. % [V,D] = eig(R*Go*R');
  22. % Fix because symmetric matrix does not have orthogonal eigenvalues
  23. [u,D,V] = svd(R*Go*R');
  24. D = D.*sign(u'*V);
  25. T = R'*V*diag(diag(D).^(-.25));
  26. ab = T\a*T;
  27. bb = T\b;
  28. cb = c*T;
  29. if nargout > 3
  30.     m = diag(dgram(ab,bb))';
  31. end
  32.