chi2rnd

Generate random data from a chi-squared distribution.

Syntax

rnd=chi2rnd(n)

rnd=chi2rnd(n,r,c)

Inputs

n
Degrees of freedom.
Type: integer
Dimension: scalar | vector | matrix
r,c
Number of matrix rows and columns.
Type: integer
Dimension: scalar

Outputs

rnd
Random data.

Examples

Single value chi2rnd example:
n = 5;
rnd = chi2rnd(n)
   rnd = 3
Vector chi2rnd example:
n = 5;
r = 1;
c = 5;
rnd = chi2rnd(n,r,c)
rnd = [Matrix] 1 x 5
3 3.0359 4.2942 2.1856 4.1324

Comments

The random number generator can be initialized using rand.