function [acl,bcl,ccl,dcl] = interc(Z1,Z2,Z3,Z4,Z5,Z6,Z7)
% [SS_CL] = INTERC(SS_,M,N,F) or
% [ACL,BCL,CCL,DCL] = INTERC(A,B,C,D,M,N,F) produces a state space
%        realization of the interconnected system, given system
%        G:(A,B,C,D) and constant blocks -- M, N and F representing 
%        the interconnections. The general set-up is as follows:
%
%           - - -    +          - - -           - - -
%   R ----->| M |----->0------->| G |---------->| N |------> Y
%           - - -      ^ +      - - -      |    - - -
%                      |                   |
%                      |        - - -      |
%                      ---------| F |<------
%                               - - -
% Note: ss_ = mksys(a,b,c,d);

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

inargs = '(a,b,c,d,m,n,f)';
eval(mkargs(inargs,nargin,'ss'))

df = d * f;
[rdf,cdf] = size(df);
k = inv(eye(rdf)-df);
acl = a + b * f * k * c;
bcl = b * (m + f * k * d * m);
ccl = n * k * c;
dcl = n * k * d * m; 
%
if xsflag 
   acl = mksys(acl,bcl,ccl,dcl);
end
%
% ----- End of INTERC.M ---- RYC/MGS 6/86 %
