1

考虑矩阵

c =

 1     2
 3     4


m = 2;
n = 2;
% mean
% sum1 = uint32(0);
b4 = sum(c);
b5 = sum(b4');
c5 = b5 / ( m * n )

% standard deviation
sum2 = uint32(0);

for i = 1 : m
   for j = 1 : n
     b = ( double(c(i,j)) - c5 ) ^ 2 ;
     sum2 = sum2 + b ;
   end
end
sum3 = sum2 / ( m * n );
std_dev = sqrt(double(sum3))

% skewness

sum9 = 0;
for i = 1 : m
    for j = 1 : n
        skewness_old = ( ( double(c(i,j)) - c5 ) / ( std_dev) )^ 3 ;
        sum9 = sum9 + skewness_old ;
    end
end
skewness_new = sum9 / ( m * n )    

偏度结果为 0

如果我使用 matlab 函数偏度,

skewness(c)

c =

 1     2
 3     4

偏度(c)

答案=

 0     0

为什么函数偏度返回两个 0,而公式只返回一个 0

4

1 回答 1

2

默认情况下, MATLAB 函数SKEWNESS分别计算每列的偏度。对于整个矩阵做skewness(c(:)).

于 2013-02-28T05:31:12.387 回答