Mercurial > hg > ltpda
diff m-toolbox/classes/+utils/@math/Kurt.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/+utils/@math/Kurt.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,25 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% 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 \ No newline at end of file