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

  1. function [sv] = sigma2(Z1,Z2,Z3,Z4,Z5,Z6)
  2. %
  3. % Singular Value Frequency Response.
  4. %
  5. % SV = SIGMA2(A,B,C,D,TYPE,W) or
  6. % SV = SIGMA2(SS_,TYPE,W) returns a matrix SV containing singular
  7. % value frequency response associated with a state space system
  8. % SS_ (created by SYSTEM)
  9. %                .
  10. %                x = Ax + Bu
  11. %                y = Cx + Du
  12. %                                                   -1
  13. % with frequency response G(jw) = C(jwI - A)  B + D   .
  14. %
  15. % SIGMA calculates the SVD of one of the following types:
  16. %
  17. %     Type = 1   ----   G(jw) 
  18. %     Type = 2   ----   inv(G(jw))
  19. %     Type = 3   ----   I + G(jw)
  20. %     Type = 4   ----   I + inv(G(jw)) 
  21. %
  22. % Vector W contains the frequencies at which the frequency response
  23. % is to be evaluated and the rows of sigma contain the singular value
  24. % frequency responses in descending order.
  25. %
  26.  
  27. % R. Y. Chiang & M. G. Safonov 5/16/85 & 10/25/90
  28. % Copyright (c) 1988 by the MathWorks, Inc.
  29. % All Rights Reserved.
  30. % -------------------------------------------------------------------
  31. %
  32.  
  33. if exist('mkargs') == 2, %If RCT installed
  34.   inargs='(a,b,c,d,Type,w)';
  35.   eval(mkargs(inargs,nargin,'ss'))
  36. else
  37.    if nargin<4,
  38.      error('Too few input arguments')
  39.    else
  40.     a=Z1; b=Z2; c=Z3; d=Z4;
  41.     if nargin > 5
  42.       w = Z6;
  43.     elseif nargin > 4,
  44.       type=Z5;
  45.     end;
  46.    end;
  47. end;
  48.  
  49. [mg] = freqrc(a,b,c,d,w);
  50. [rmg,cmg] = size(mg);
  51. [rb,cb] = size(b);
  52. [rc,cc] = size(c);
  53. gg = ones(rc,cb);
  54. for is = 1 : cmg
  55.   gg(:) = mg(:,is);
  56.   if (Type == 1)
  57.     sv(:,is) = svd(gg);
  58.   end
  59.   if (Type == 2)
  60.     sv(:,is) = svd(inv(gg));
  61.   end
  62.   if (Type == 3)
  63.     sv(:,is) = svd(eye(cb) + gg);
  64.   end
  65.   if (Type == 4)
  66.     sv(:,is) = svd(eye(cb) + inv(gg));
  67.   end
  68. end
  69. %
  70. % ----- End of SIGMA2.M ---- RYC/MGS 5/16/85 %
  71.