function [ai,bi,ci,di] = ssinv(Z1,Z2,Z3,Z4)
% [SS_I] = SSINV(SS_) or
% [AI,BI,CI,DI] = SSINV(A,B,C,D) computes the inverse system
%                       -1
%         GI(s) = [G(s)]
%                                        -1         -1      -1           -1
% using the state-space formulae AI=A-B D  C, BI=B D  , CI=D  C, and DI=D  .


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

%
di = inv(d);
ai = a - b*di*c;
bi = b*di;
ci = -di*c;

if xsflag
   ai = mksys(ai,bi,ci,di);
end
%
% ---------------- End of SSINV.M -- RYC/MGS %
