% Calculate Kurtosis of complex valued data according to Hyvirinen's defination 
% Input:
% x: Complex valued N dimensional vector;
% kurtc(x) = 0 for a zero mean, unit variance and INDEPENDENT real and imaginary parts Gaussian r.v.;
% kurtc(x) = 1 for a r.v. with maginitude part Gaussian r.v and phase part uniformly distibuted, 
% Note: The estimation of the 4th order statistics of x uses unbiased sample mean; {.../(n-1)}
% By Yi-Ou Li Apr. 2004

function kurtc = kurtc(x)

x = x-mean(x);

x = x/std(x);

n = prod(size(x));

% xr = real(x);
% xi = imag(x);
% kurtc = sum(xr.^4)/(n-1) + sum(xi.^4)/(n-1) + 2*mean((xr.^2).*(xi.^2)) - 2;

kurtc = mean(abs(x).^4)-mean(x.^2)*mean(conj(x).^2)-2;