Kurtosis ignoring 0s in matrix

3 次查看(过去 30 天)
Hi there, I was wondering I have a matrix A of size 295x34. I want to do the kurtosis, but want to ignore all zeros.
How can I do this?

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-7-24
编辑:Andrei Bobrov 2012-7-24
out = cellfun(@(x)kurtosis(x(x~=0)),num2cell(A,1));
or
s = sum(A~=0);
x1 = bsxfun(@minus,A,sum(A)./s);
x1(A == 0) = 0;
out = s.*sum(x1.^4)./ sum(x1.^2).^2;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Statistics and Machine Learning Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by