view m-toolbox/classes/+utils/@math/Skew.m @ 39:11e3ed9d2115
database-connection-manager
Implement databases listing in database connection dialog
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
line source
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Compute the sample (bias-corrected) skewness.
%
% CALL
%
% p = Skew(x);
%
% VERSION: $Id: Skew.m,v 1.1 2011/02/25 10:04:07 congedo Exp $
%
% HISTORY: 25-02-2011 G. Congedo
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function s = Skew(x)
n = numel(x);
mu3 = sum((x-mean(x)).^3)/n;
sig = sqrt(sum((x-mean(x)).^2)/n);
s = mu3/(sig)^3;
% Bias correction
s = sqrt(n*(n-1))/(n-2)*s;
end