function [mg] = freqrc(Z1,Z2,Z3,Z4,Z5)
%
% Generalized complex frequency response calculation.
%
% [G] = FREQRC(SS_,W) or
% [G] = FREQRC(A,B,C,D,W) produces a matrix G containing
% the complex frequency response :
%                                  -1
%     G(s) = Y(s)/U(s) = C(sI - A)   B + D
%
% of the linear system described in  state space as : 
%             .
%             x = Ax + Bu
%             y = Cx + Du
%
% when evaluated at the frequencies in complex vector W.
% Returned in G is a matrix where each column corresponds to a 
% frequency point in W, and each row corresponds to a paticular
% U-Y pair. The first ny rows, where ny is the size of the Y vector,
% correspond to the responses from the first input. And so on up to 
% ny * nu where nu is the size of the U vector.


% R. Y. Chiang & M. G. Safonov 5/16/85
% Copyright (c) 1988 by the MathWorks, Inc.
% All Rights Reserved.
% ------------------------------------------------------------------
%

inargs = '(a,b,c,d,w)';
eval(mkargs(inargs,nargin,'ss'))

[rb,cb] = size(b);
%
% Calculating G(jw) :
%
[p,a] = hess(a);
b = p'*b;
c = c*p;
%
for iu = 1 : cb
    [g] = clxbode(a,b,c,d,iu,w);
    if iu == 1
       mg = g;
    else
       mg = [mg;g];
    end
end
%
% ------ End of FREQRC.M --- RYC/MGS 5/16/85 %