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

  1. function [mu,logd] = ssv(Z1,Z2,Z3,Z4,Z5,Z6,Z7)
  2. % [MU,LOGD] = SSV(A,B,C,D,W) or SSV(A,B,C,D,W,K) or (A,B,C,D,W,K,OPTION)
  3. % or [MU,LOGD] = SSV(SS_,...), etc. produces the row-vector MU
  4. % containing an upper bound on the structured singular value (ssv) of 
  5. %        G(jw) = C * inv(jwI-A) * B + D
  6. % at each frequency in the real vector w. 
  7. % Input: 
  8. %     A,B,C,D  -- state-space matrices of pxq transfer function matrix G(s)
  9. %     W        -- vector of frequencies at which MU is to be computed
  10. % Optional inputs:
  11. %     K  -- uncertainty block sizes--default is K=ones(q,2).  K is an
  12. %           an nx1 or nx2 matrix whose rows are the uncertainty block
  13. %           sizes for which the ssv is to be evaluated; K must satisfy 
  14. %           sum(K) == [q,p].If i_th uncertainty is real, set K(i,:) = [-1 -1].
  15. %           If only the first column of K is given then the
  16. %           uncertainty blocks are taken to be square, as if K(:,2)=K(:,1).
  17. %           
  18. %     OPTION  -- method for computing MU, one of the following: 'psv' (by
  19. %            default) or 'osborne' or 'perron' (if only "MU" output specified)
  20. %            or 'muopt' (multiplier approach for real/complex uncertainties).
  21. % Outputs:
  22. %     MU      -- the bode plot of MU
  23. %     LOGD    -- the optimal diagonal scaling D, (exp(LOGD) is the value)
  24.  
  25. % R. Y. Chiang & M. G. Safonov 1/87
  26. % Copyright (c) 1988-92 by the MathWorks, Inc.
  27. % All Rights Reserved.
  28. % -------------------------------------------------------------------
  29. %
  30.  
  31. nag1 = nargin;
  32. inargs = '(a,b,c,d,w,k,option)';
  33. eval(mkargs(inargs,nag1,'ss'))
  34. nag1 = nargin;    % NARGIN may have been changed
  35. nag2 = nargout;
  36.  
  37. if nag1 == 5 
  38.    [rd,cd] = size(d);
  39.    k = ones(cd,2);
  40.    option = 'psv';
  41. end
  42.  
  43. if isempty(k)
  44.    [rd,cd] = size(d);
  45.    k = ones(cd,2);
  46. end;
  47.  
  48. fprintf('Excuting SSV.');
  49. if nag1 == 6
  50.    option = 'psv';
  51. end
  52.  
  53. if nag2 == 1 & nag1 < 7
  54.    option = 'perron';
  55. end
  56.  
  57. if min(k(:,1)) < 0 
  58.    option = 'muopt';
  59. end
  60.  
  61. [mg] = freqrc(a,b,c,d,w);
  62. [rmg,cmg] = size(mg);
  63. [rd,cd] = size(d);
  64. gg = ones(rd,cd);
  65. [rk,ck] = size(k);
  66. logd = zeros(rk,cmg);
  67. %
  68. for is = 1 : cmg
  69.      fprintf('.');
  70.      gg(:) = mg(:,is);
  71.      if issame('psv',option),
  72.         [mu(is),junk,logd(:,is)] = psv(gg,k);
  73.      elseif issame('perron',option)
  74.         mu(is) = perron(gg,k);
  75.      else
  76.         eval(['[mu(is),junk,d_db(:,is)] = ' option '(gg,k);']);
  77.      end
  78. end
  79. fprintf('.Done SSV\n');
  80. %
  81. % ----- End of SSV.M ---- RYC/MGS 8/88 
  82.