kurt2.m 551 B

123456789101112131415161718192021222324
  1. % K = KURT2(MTX,MEAN,VAR)
  2. %
  3. % Sample kurtosis (fourth moment divided by squared variance)
  4. % of a matrix. Kurtosis of a Gaussian distribution is 3.
  5. % MEAN (optional) and VAR (optional) make the computation faster.
  6. % Eero Simoncelli, 6/96.
  7. function res = kurt2(mtx, mn, v)
  8. if (exist('mn') ~= 1)
  9. mn = mean(mean(mtx));
  10. end
  11. if (exist('v') ~= 1)
  12. v = var2(mtx,mn);
  13. end
  14. if (isreal(mtx))
  15. res = mean(mean(abs(mtx-mn).^4)) / (v^2);
  16. else
  17. res = mean(mean(real(mtx-mn).^4)) / (real(v)^2) + ...
  18. i*mean(mean(imag(mtx-mn).^4)) / (imag(v)^2);
  19. end