home *** CD-ROM | disk | FTP | other *** search
- function [cg,ph] = cgloci2(Z1,Z2,Z3,Z4,Z5,Z6)
- %
- % Characteristic Gain/Phase Frequency Response.
- %
- % [CG,PH] = CGLOCI2(SS_,Type,W) or
- % [CG,PH] = CGLOCI2(A, B, C, D, Type, W) produces the matrix CG & PH
- % containing the characteristic Gain/Phase values for the system
- % .
- % x = Ax + Bu
- % y = Cx + Du
- % -1
- % with the frequency response G(jw) = C(jwI - A) B + D.
- % CGLOCI calculates eigenvalues of one of the following depending on the
- % value of Type:
- %
- % Type = 1 ---- G(jw)
- % Type = 2 ---- inv(G(jw))
- % Type = 3 ---- I + G(jw)
- % Type = 4 ---- I + inv(G(jw))
- %
- % Vector W contains the frequencies at which the frequency response
- % is to be evaluated. The CG and PH matrices have rows which
- % correspond to the characteristic gain/phase in decending order.
-
- % R. Y. Chiang & M. G. Safonov 6/29/87
- % Copyright (c) 1988 by the MathWorks, Inc.
- % All Rights Reserved.
-
- inargs='(a,b,c,d,Type,w)';
- eval(mkargs(inargs,nargin,'ss'))
-
- [mg] = freqrc(a,b,c,d,w);
- [rmg,cmg] = size(mg);
- [rb,cb] = size(b);
- [rc,cc] = size(c);
- gg = ones(rc,cb);
- for is = 1 : cmg
- gg(:) = mg(:,is);
- if (Type == 1)
- char = eig(gg);
- cg(:,is) = sort(abs(char));
- ph(:,is) = sort(180./pi*imag(log(char)));
- end
- if (Type == 2)
- char = eig(inv(gg));
- cg(:,is) = sort(abs(char));
- ph(:,is) = sort(180./pi*imag(log(char)));
- end
- if (Type == 3)
- [tmp1,tmp2]=size(gg);
- char = eig(eye(tmp1,tmp2)+gg);
- cg(:,is) = sort(abs(char));
- ph(:,is) = sort(180./pi*imag(log(char)));
- end
- if (Type == 4)
- [tmp1,tmp2]=size(gg);
- char = eig(eye(tmp1,tmp2)+inv(gg));
- cg(:,is) = sort(abs(char));
- ph(:,is) = sort(180./pi*imag(log(char)));
- end
- end
- cg = cg(cb:-1:1,:);
- ph = ph(cb:-1:1,:);
- %
- % ----- End of CGLOCI2.M ---- RYC/MGS 6/29/87 %
-
-
-