comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Compute the sample (bias-corrected) excess kurtosis.
4 %
5 % CALL
6 %
7 % p = Kurt(x);
8 %
9 % VERSION: $Id: Kurt.m,v 1.1 2011/02/25 10:04:07 congedo Exp $
10 %
11 % HISTORY: 25-02-2011 G. Congedo
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function k = Kurt(x)
16
17 n = numel(x);
18 mu4 = sum((x-mean(x)).^4)/n;
19 sig = sqrt(sum((x-mean(x)).^2)/n);
20 k = mu4/(sig)^4;
21
22 % Bias correction
23 k = (n-1)/(n-2)/(n-3)*((n+1)*k-3*(n-1));
24
25 end