view m-toolbox/classes/+utils/@math/Kurt.m @ 44:409a22968d5e
default
Add unit tests
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Tue, 06 Dec 2011 18:42:11 +0100 (2011-12-06) |
parents |
f0afece42f48 |
children |
|
line source
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compute the sample (bias-corrected) excess kurtosis.
%
% CALL
%
% p = Kurt(x);
%
% VERSION: $Id: Kurt.m,v 1.1 2011/02/25 10:04:07 congedo Exp $
%
% HISTORY: 25-02-2011 G. Congedo
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function k = Kurt(x)
n = numel(x);
mu4 = sum((x-mean(x)).^4)/n;
sig = sqrt(sum((x-mean(x)).^2)/n);
k = mu4/(sig)^4;
% Bias correction
k = (n-1)/(n-2)/(n-3)*((n+1)*k-3*(n-1));
end