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

  1. function [cg,ph] = cgloci2(Z1,Z2,Z3,Z4,Z5,Z6)
  2. %
  3. % Characteristic Gain/Phase Frequency Response.
  4. % [CG,PH] = CGLOCI2(SS_,Type,W) or
  5. % [CG,PH] = CGLOCI2(A, B, C, D, Type, W) produces the matrix CG & PH 
  6. % containing the characteristic Gain/Phase values for the system
  7. %                .
  8. %                x = Ax + Bu
  9. %                y = Cx + Du
  10. %                                                   -1
  11. %     with the frequency response G(jw) = C(jwI - A)  B + D.
  12. % CGLOCI calculates eigenvalues of one of the following depending on the 
  13. % value of Type: 
  14. %
  15. %     Type = 1   ----   G(jw)
  16. %     Type = 2   ----   inv(G(jw)) 
  17. %     Type = 3   ----   I + G(jw)
  18. %     Type = 4   ----   I + inv(G(jw)) 
  19. %
  20. % Vector W contains the frequencies at which the frequency response
  21. % is to be evaluated.  The CG and PH matrices have rows which 
  22. % correspond to the characteristic gain/phase in decending order.
  23.  
  24. % R. Y. Chiang & M. G. Safonov 6/29/87
  25. % Copyright (c) 1988 by the MathWorks, Inc.
  26. % All Rights Reserved.
  27.  
  28. inargs='(a,b,c,d,Type,w)';
  29. eval(mkargs(inargs,nargin,'ss'))
  30.  
  31. [mg] = freqrc(a,b,c,d,w);
  32. [rmg,cmg] = size(mg);
  33. [rb,cb] = size(b);
  34. [rc,cc] = size(c);
  35. gg = ones(rc,cb);
  36. for is = 1 : cmg
  37.   gg(:) = mg(:,is);
  38.   if (Type == 1)
  39.     char = eig(gg);
  40.     cg(:,is) = sort(abs(char)); 
  41.     ph(:,is) = sort(180./pi*imag(log(char))); 
  42.   end
  43.   if (Type == 2)
  44.     char = eig(inv(gg));
  45.     cg(:,is) = sort(abs(char));
  46.     ph(:,is) = sort(180./pi*imag(log(char)));
  47.   end
  48.   if (Type == 3)
  49.     [tmp1,tmp2]=size(gg);
  50.     char = eig(eye(tmp1,tmp2)+gg);
  51.     cg(:,is) = sort(abs(char)); 
  52.     ph(:,is) = sort(180./pi*imag(log(char))); 
  53.   end
  54.   if (Type == 4)
  55.     [tmp1,tmp2]=size(gg);
  56.     char = eig(eye(tmp1,tmp2)+inv(gg));
  57.     cg(:,is) = sort(abs(char)); 
  58.     ph(:,is) = sort(180./pi*imag(log(char))); 
  59.   end
  60. end
  61. cg = cg(cb:-1:1,:);
  62. ph = ph(cb:-1:1,:);
  63. %
  64. % ----- End of CGLOCI2.M ---- RYC/MGS 6/29/87 %
  65.  
  66.  
  67.