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

  1. % function [sys1,sig1] = sfrwtbal(sys,wt1,wt2);
  2. %
  3. %   Calculates the stable part of MINV(WT1~)*SYS*MINV(wt2~)    
  4. %   and then SYS1 is a balanced realization of this, with 
  5. %   Hankel singular values SYS1. WT1 and WT2 must be stable 
  6. %   and minimum phase, square and of compatible dimensions with 
  7. %   SYS.  WT2 has the identity as default value and  SYS must 
  8. %   be stable.
  9. %   SYS1(k) gives a lower bound on the achievable H-infinity
  10. %   norm of the error MINV(WT1~)*(SYS-SYSHAT)*MINV(WT2~)
  11. %   where SYSHAT is stable of degree K.  The routine is used 
  12. %   with SFRWTBLD to obtain a possible SYSHAT as follows:
  13. %
  14. %     >>[sys1,sig1] = sfrwtbal(sys,wt1,wt2);
  15. %     >>sys1hat = strunc(sys1,k);
  16. %   or 
  17. %     >>sys1hat = hankmr(sys1,sig1,k);
  18. %     >>syshat = sfrwtbld(sys1hat,wt1,wt2);
  19. %
  20. %   The resulting error can be assessed with a direct frequency
  21. %   response calculation.
  22. %
  23. %   See also: HANKMR, SFRWTBLD, SNCFBAL, SRELBAL, SYSBAL,
  24. %             SRESID, and TRUNC.
  25.  
  26. % Based on the algorithm of Latham and Anderson
  27. % Systems and Control Letters, vol 5, 229:236, 1985.
  28.  
  29.  
  30. function [sys1,sig1] = sfrwtbal(sys,wt1,wt2);
  31.  
  32. % initial consistency checks.
  33. if nargin <2, 
  34.   disp('usage: [sys1,sig1] = sfrwtbal(sys,wt1,wt2);')
  35.   return
  36. end
  37.  
  38. [systype,p,m,n] = minfo(sys);
  39. if nargin==2, wt2 = eye(m); end
  40. [wt1type,p1,m1,n1] = minfo(wt1);
  41. [wt2type,p2,m2,n2] = minfo(wt2);
  42.  
  43. if systype~='syst'
  44.   error('SYS must be a SYSTEM matrix')
  45.   return
  46. end
  47. if wt1type=='vary'
  48.   error('WT1 must  be a SYSTEM or CONSTANT matrix')
  49.   return
  50. end
  51. if wt2type=='vary'
  52.   error('WT2 must  be a SYSTEM or CONSTANT matrix')
  53.   return
  54. end
  55. if m1~=p1 | m1~=p
  56.   error('WT1 should be square compatible with SYS')
  57.   return
  58. end
  59. if m2~=p2 | m2~=m
  60.   error('WT2 should be square compatible with SYS')
  61.   return
  62. end
  63. if any(spoles(sys)>=0)
  64.   error('SYS should be stable')
  65.   return
  66. end
  67. if wt1type=='syst'
  68.   if any(spoles(wt1)>=0)
  69.     error('WT1 should be stable')
  70.     return
  71.   end
  72.   if any(szeros(wt1)>0)
  73.     error('WT1 should be minimum phase')
  74.     return
  75.   end
  76. end %if wt1type==
  77. if wt2type=='syst',
  78.   if any(spoles(wt2)>=0)
  79.     error('WT2 should be stable')
  80.     return
  81.   end
  82.   if any(szeros(wt2)>0)
  83.     error('WT2 should be minimum phase')
  84.     return
  85.   end
  86.  end % if wt2type==
  87. %
  88. wt1=minv(cjt(wt1)); wt2=minv(cjt(wt2));
  89. sys1=sdecomp(mmult(wt1,mmult(sys,wt2)));
  90. [sys1,sig1]=sysbal(sys1);
  91. %
  92. % Copyright MUSYN INC 1991,  All Rights Reserved
  93.