How to use original n-th moments formula to calculate mean, skewness and kurtosis in uniform distribution?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am very new to MATLAB,
here is the original n-th moments formula:
and pdf shows below:
I know mean=0.5 , skewness = 0 and kurtosis=9/5, but face problem to calculate it in MATLAB.
I have tried:
fun = @(x,n) (x-mean(x).^n
q = integral(@(x) fun(x,1),0,1)
but the answer is wrong.
Thank you all anyway!
0 commentaires
Réponses (1)
Jeff Miller
le 21 Avr 2020
I don't think mean(x) gives you what you want inside fun. Try this:
fun = @(x,n) (x-0.5).^n;
5 commentaires
Jeff Miller
le 22 Avr 2020
With n=1, the answer should be zero, not 0.5. With n=1 your function is computing the average of [x - mean(x)]. Some x's are above the mean, some are below, so by definition the function's value must be zero.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!