RANDNCHI Generate Noncentral Chi-Square Random Variable
Section: Random Number Generation
UsageGenerates a vector of non-central chi-square random variables with the given number of degrees of freedom and the given non-centrality parameters. The general syntax for its use is
y = randnchi(n,mu)
n is an array containing the degrees of freedom for
each generated random variable (with each element of
n >= 1),
mu is the non-centrality shift (must be positive).
Function InternalsA non-central chi-square random variable is the sum of a chisquare deviate with
n-1degrees of freedom plus the square of a normal deviate with mean
muand standard deviation 1.
ExamplesHere is an example of a non-central chi-square random variable:
--> randnchi(5*ones(1,9),0.3) ans = Columns 1 to 8 1.7097 6.6003 14.1463 2.0817 4.4984 5.3132 3.1775 3.5291 Columns 9 to 9 5.5185