comparison m-toolbox/classes/+utils/@math/Skew.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) skewness.
4 %
5 % CALL
6 %
7 % p = Skew(x);
8 %
9 % VERSION: $Id: Skew.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 s = Skew(x)
16
17 n = numel(x);
18 mu3 = sum((x-mean(x)).^3)/n;
19 sig = sqrt(sum((x-mean(x)).^2)/n);
20 s = mu3/(sig)^3;
21
22 % Bias correction
23 s = sqrt(n*(n-1))/(n-2)*s;
24
25 end