u = chi2rnd(nu, [N,1]);

Hi,
I use the chi2rnd to generate random variables. This function asks me as an input the degrees of freedom, but I do not know how it is calculated. If someone could help me with this, be grateful. For example, in this case "u = chi2rnd (nu, [N, 1])", what are the degrees of freedom nu?

Respuestas (1)

Daniel Shub
Daniel Shub el 27 de Oct. de 2011

0 votos

The degrees of freedom is a parameter of the distribution. Basically, you can rewrite chi2rnd as:
chi2rnd = @(nu, siz)sum(randn([nu, siz]).^2);
Basically, the degrees of freedom nu is how many normal random variables you are going to sum together. Its value really depends on your application.

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Oct. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by