📄 kurtosis2.m
字号:
function k = kurtosis2(x, dimension)% % This program calculates the kurtosis. % % % % The normal distribution has a kurtosis of 3.% % % % Description% % % % If A = M x N matix, kurtosis(A) = 1 x N vector.% % If A = M x N matix, kurtosis(A,1) = 1 x N vector.% % If A = M x N matix, kurtosis(A,2) = M x 1 vector.% % Example='';% x=randn(1,1000); % x is the gaussian distribution % k = kurtosis(x, dimension)% % % Output Variables% % % % k kurtosis unitless% % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Written by William Murphy ~2001% % modified by Edward Zechmann 19 December 2007 % % added comments % % removed fourth moment% % modified by Edward Zechmann 27 December 2007 % % changed filename to kurtosis2.m% % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % Please feel free to modify this code.% % if nargin < 2 [buf dimension]=max(size(x));endxsize = size(x);if max(max(max(xsize))) > 0 m = mean(x,dimension); s = std(x,0,dimension); if dimension == 1 k = (sum((x - repmat(m,[xsize(dimension),1])).^4,dimension)./(xsize(dimension)*s.^4)); else %Here, we have to flip the repmat function since the dimension is different. k = (sum((x - repmat(m,[1,xsize(dimension)])).^4,dimension)./(xsize(dimension)*s.^4)); end else k = zeros(size(x));end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -