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

  1. % function [sysst,sysun] = sdecomp(sys,bord,fl)
  2. %
  3. %   Decomposes a system into the sum of two systems, 
  4. %      SYS = MADD(SYSST,SYSUN).
  5. %      SYSST has the real parts of all its poles < BORD
  6. %      SYSUN has the real parts of all its poles >= BORD
  7. %      BORD has default value 0.
  8. %
  9. %    The D matrix for SYSUN is zero unless FL = 'd' when 
  10. %    that for SYSST is zero.
  11. %
  12. %   See Also: HANKMR, SFRWTBAL, SFRWTBLD, SNCFBAL, SREALBAL, and SYSBAL.
  13.  
  14.  
  15. function [sysst,sysun] = sdecomp(sys,bord,fl)
  16.   if nargin < 1
  17.     disp('usage: [sysst,sysun] = sdecomp(sys,bord,fl)')
  18.     return
  19.   end
  20.  
  21. [mattype,p,m,n]=minfo(sys);
  22. if mattype~='syst', 
  23.    disp('usage: [sysst,sysun] = sdecomp(sys,bord,fl)')
  24.    return
  25. end
  26. if nargin==1, bord=0;fl='s'; end
  27. if nargin==2, fl='s';end
  28. [a,b,c,d]=unpck(sys);
  29. [u,a]=schur(a);
  30. [u,a,k]=orsf(u,a,'s',bord);
  31. if k==0, sysst=zeros(p,m); sysun=sys; end
  32. if k==n, sysst=sys; sysun=zeros(p,m); end
  33. kp=k+1;
  34. if k<n & k>0,
  35.   x=axxbc(a(1:k,1:k),-a(kp:n,kp:n),-a(1:k,kp:n));
  36.   ah=a(1:k,1:k);
  37.   bh=[eye(k),-x]*u'*b;
  38.   ch=c*u(:,1:k);
  39.   if fl=='s', dh=d; du=zeros(p,m);
  40.      else, du=d; dh=zeros(p,m); end
  41.   sysst=pck(ah,bh,ch,dh);
  42.   au=a(kp:n,kp:n);
  43.   bu=u(:,kp:n)'*b;
  44.   cu=c*u*[x;eye(n-k)];
  45.   sysun=pck(au,bu,cu,du);
  46.  end %if k<n & k>0,
  47. %
  48. % Copyright MUSYN INC 1991,  All Rights Reserved
  49.