next up previous contents
Next: RANDNF Generate Noncentral F-Distribution Up: Random Number Generation Previous: RANDMULTI Generate Multinomial-distributed Random   Contents

Subsections

RANDNCHI Generate Noncentral Chi-Square Random Variable

Usage

Generates 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)

where n is an array containing the degrees of freedom for each generated random variable (with each element of n >= 1), and mu is the non-centrality shift (must be positive).

Function Internals

A non-central chi-square random variable is the sum of a chisquare deviate with n-1 degrees of freedom plus the square of a normal deviate with mean mu and standard deviation 1.

Examples

Here is an example of a non-central chi-square random variable:

--> randnchi(5*ones(1,9),0.3)
ans = 
  <float>  - size: [1 9]
 
Columns 1 to 3
    0.0066034445       0.026907619        0.0088143516    
 
Columns 4 to 6
    0.042577077        0.0067255395       0.19600929      
 
Columns 7 to 9
    0.12045909         4.7910717e-06      7.9838595e-05



Samit K. Basu 2005-03-16