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

  1. function [ab,bb,cb,g,t] = balreal(a,b,c)
  2. %BALREAL  Balanced state-space realization and model reduction.
  3. %    [Ab,Bb,Cb] = BALREAL(A,B,C) returns a balanced state-space 
  4. %    realization of the system (A,B,C).
  5. %
  6. %    [Ab,Bb,Cb,G,T] = BALREAL(A,B,C) also returns a vector G containing
  7. %    the diagonal of the gramian of the balanced realization, and 
  8. %    matrix T, the similarity transformation used to convert (A,B,C) 
  9. %    to (Ab,Bb,Cb).  If the system (A,B,C) is normalized properly, 
  10. %    small elements in gramian G indicate states that can be removed to
  11. %    reduce the model to lower order.
  12.  
  13. %    J.N. Little 3-6-86
  14. %    Revised 12-30-88
  15. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  16.  
  17. %    See:
  18. %     1) Moore, B., Principal Component Analysis in Linear Systems:
  19. %        Controllability, Observability, and Model Reduction, IEEE 
  20. %        Transactions on Automatic Control, 26-1, Feb. 1981.
  21. %     2) Laub, A., "Computation of Balancing Transformations", Proc. JACC
  22. %        Vol.1, paper FA8-E, 1980.
  23.  
  24. gc = gram(a,b);
  25. go = gram(a',c');
  26. r = chol(gc);
  27. rgr = r*go*r';
  28. rgr = tril(rgr) + tril(rgr,-1)';  % Make rgr exactly symmetric.
  29. [v,d] = eig(rgr);
  30. t = r'*v*diag(diag(d).^(-.25));
  31. ab = t\a*t;
  32. bb = t\b;
  33. cb = c*t;
  34. g = diag(gram(ab,bb))';
  35.  
  36. % Sort so g is in descending order
  37. [gg,i]=sort(g);
  38. i = i(length(g):-1:1);
  39. ab = ab(i,i);
  40. bb = bb(i,:);
  41. cb = cb(:,i);
  42. t = t(:,i);
  43. g = g(i);
  44.