How to use original n-th moments formula to calculate mean, skewness and kurtosis in uniform distribution?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Jeff Miller
el 21 de Abr. de 2020
I don't think mean(x) gives you what you want inside fun. Try this:
fun = @(x,n) (x-0.5).^n;
5 comentarios
Jeff Miller
el 22 de Abr. de 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.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!