function s = skewness(x)
%SKEWNESS Skewness. 
%   For vectors, SKEWNESS(x) returns the sample skewness.  
%   For matrices, SKEWNESS(X)is a row vector containing the sample
%   skewness of each column. The skewness is the third central 
%   moment divided by the cube of the standard deviation.
%
%   See also MEAN, MOMENT, STD, VAR, KURTOSIS.

%   B.A. Jones 2-6-96
%   Copyright (c) 1993-96 by The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 1996/03/05 14:57:22 $

[row, col] = size(x);

if row == 1 & col == 1
    s = 0;
else
   m3 = moment(x,3);
   sm2 = sqrt(moment(x,2));
   s = m3./sm2.^3;
end
   
