function [hsv,p,q] = hksv(a,b,c)
%
% [HSV,P,Q] = HKSV(A,B,C) computes reachability and observability
%    grammians P, Q, and the Hankel singular values "hsv".
%

% R. Y. Chiang & M. G. Safonov 3/86
% Copyright (c) 1988 by the MathWorks, Inc.
% All Rights Reserved.
% ------------------------------------------------------------------
p = gram(a,b);
q = gram(a',c');
hsv = sqrt(eig(p*q));
[hsv,index] = sort(real(hsv));
[ma,na] = size(a);
hsv = hsv(ma:-1:1,:);
%
% -------- End of HKSV.M --- RYC/MGS 