Statistics Toolbox | ![]() ![]() |
Random numbers from the chi-square (2) distribution
Syntax
Description
generates random numbers from the R = chi2rnd(V)
2 distribution with degrees of freedom parameters specified by V. R is the same size as V.
generates a matrix of size R = chi2rnd(V,m)
m
containing random numbers from the 2 distribution with degrees of freedom parameter V, where m is a 1-by-2 vector containing the row and column dimensions of R.
generates an R = chi2rnd(V,m,n)
m
-by-n
matrix containing random numbers from the 2 distribution with degrees of freedom parameter V.
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
See Also
chi2cdf
, chi2inv
, chi2pdf
, chi2stat
![]() | chi2pdf | chi2stat | ![]() |