How to use original n-th moments formula to calculate mean, skewness and kurtosis in uniform distribution?

1 visualización (últimos 30 días)
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!

Respuestas (1)

Jeff Miller
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
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.
Jing Tang
Jing Tang el 22 de Abr. de 2020
I plot my PDF function below:
my calculus sucks:(
my problem is:
this uniform distribution has 2 formula based on value. I don't know how to put 2 formula in one intergal formula.
I think it's quiet simple, but I can't find a solution.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by