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

  1. function [sv] = dsigma2(Z1,Z2,Z3,Z4,Z5,Z6,Z7)
  2. %
  3. % Discrete Singular Value Frequency Response.
  4. %
  5. % SV = DSIGMA2(SS_, TYPE, W, TS) or
  6. % SV = DSIGMA2(A, B, C, D, TYPE, W, TS) produces the matrix SV
  7. % containing the singular values of the square system 
  8. %
  9. %            x[n+1] = Ax[n] + Bu[n]                  
  10. %            y[n]   = Cx[n] + Du[n]
  11. %                                          -1
  12. %     with frequency response G(z) = C(zI-A) B + D.
  13. % DSIGMA calculates the SVD of one of the following depending on the 
  14. % value of TYPE : 
  15. %
  16. %     Type = 1   ----   G(z)  
  17. %     Type = 2   ----   inv(G(z))
  18. %     Type = 3   ----   I + G(z)
  19. %     Type = 4   ----   I + inv(G(z)) 
  20. %
  21. % Vector W contains the frequencies at which the frequency response
  22. % is to be evaluated. The SV matrix has rows which correspond to the 
  23. % singular values in decending order.
  24.  
  25. % R. Y. Chiang & M. G. Safonov 6/23/87
  26. % Revised W. Wang 7/24/92
  27. % Copyright (c) 1988 by the MathWorks, Inc.
  28. % All Rights Reserved.
  29. % ------------------------------------------------------------------------
  30. %
  31.  
  32. if exist('mkargs') == 2, %If RCT installed
  33.   inargs = '(a,b,c,d,Type,w,Ts)';
  34.   eval(mkargs(inargs,nargin,'ss'))
  35. else                       % If RCT not installed
  36.   % assign a=Z1;...,Type=Z5;w=Z6;Ts=Z7;
  37.   if nargin<4,
  38.     error('Too few input arguments')
  39.   else
  40.     a=Z1; b=Z2; c=Z3; d=Z4;
  41.     if nargin>6,
  42.       Ts=Z7;
  43.     elseif nargin>5,
  44.       w=Z6;
  45.     elseif nargin>4,
  46.       Type=Z5;
  47.     end
  48.   end
  49. end;
  50.  
  51. [mg] = dfreqrc(a,b,c,d,w,Ts);
  52. [rmg,cmg] = size(mg);
  53. [rb,cb] = size(b);
  54. [rc,cc] = size(c);
  55. gg = ones(rc,cb);
  56. for is = 1 : cmg
  57.   gg(:) = mg(:,is);
  58.   if (Type == 1)
  59.     sv(:,is) = svd(gg);
  60.   end
  61.   if (Type == 2)
  62.     sv(:,is) = svd(inv(gg));
  63.   end
  64.   if (Type == 3)
  65.     sv(:,is) = svd(eye(cb) + gg);
  66.   end
  67.  
  68.   if (Type == 4)
  69.     sv(:,is) = svd(eye(cb) + inv(gg));
  70.   end
  71. end
  72. %
  73. % ----- End of DSIGMA2.M ---- RYC/MGS 6/23/87 %
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.