function nmh2 = normh2(Z1,Z2,Z3,Z4)
% [NMH2] = NORMH2(A,B,C,D) or
% [NMH2] = NORMH2(SS_) computes the H2 norm of the given state-space
%    realization. If the system not strictly proper, INF is returned. 
%    Otherwise, the H2 norm is computed as
% 
%            NMH2 = trace[CPC'] = trace[B'QB]
%
%    where P is the controllability grammian, and Q is the observability
%    grammian.

% R. Y. Chiang & M. G. Safonov 8/91
% Copyright (c) 1991 by the MathWorks, Inc.
% All Rights Reserved.

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

if norm(d,'fro') > sqrt(eps)
   nmh2 = inf;
   return
end

P = gram(a,b);
nmh2 = trace(c*P*c');

%
% ---- End of NORMH2.M % RYC/MGS %


