| Statistics Toolbox | Search  Help Desk |
| chi2rnd | Examples |
Random numbers from the chi-square (
2) distribution.
Syntax
R = chi2rnd(V) R = chi2rnd(V,m) R = chi2rnd(V,m,n)
Description
R = chi2rnd(V) generates
2 random numbers with V degrees of freedom. The size of R is the size of V.
R = chi2rnd(V,m) generates
2 random numbers with V degrees of freedom. m is a 1-by-2 vector that contains the row and column dimensions of R.
R = chi2rnd(V,m,n) generates
2 random numbers with V degrees of freedom. The scalars m and n are the row and column dimensions of R.
Examples
Note that the first and third commands are the same but are different from the second command.r = chi2rnd(1:6)
r =
0.0037 3.0377 7.8142 0.9021 3.2019 9.0729
r = chi2rnd(6,[1 6])
r =
6.5249 2.6226 12.2497 3.0388 6.3133 5.0388
r = chi2rnd(1:6,1,6)
r =
0.7638 6.0955 0.8273 3.2506 1.5469 10.9197