Why doesn't the kurtosis function work properly for complex numbers?
Afficher commentaires plus anciens
Good morning,
I was trying out the kurtosis function on Matlab with complex numbers, using the following code:
var = sqrt(1/2) * randn(1,1000) + 1i * sqrt(1/2) * randn(1,1000);
var_kurt = kurtosis(var);
I was expecting var_kurt to equal 3, since I'm calculating the kurtosis of a gaussian distributed complex function, but instead I get a value of 68.7674 +18.3410i. However, kurtosis(real(var)) does equal 3, which surprises me since the kurtosis should not depend on the variable being complex. Any idea why this happens?
Thanks very much in advance,
Guillem
1 commentaire
Star Strider
le 20 Sep 2022
The kurtosis function involves raising functions of the argument to the 4th power. In my experience, squaring a complex vector is the operation of multiplying it element-wise by its complex conjugate (the absolute value is the square root of that operation), rather than squaring the real and imaginary elements separately. It would likely be necessary to re-write the function to do that and then square that result to get the 4th power of the complex array that represents your data. The kurtosis function apparently assumes that all the arguments to it will be real.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!