Statistics Toolbox | ![]() ![]() |
Random numbers from the gamma distribution
Syntax
Description
R = gamrnd(A,B)
generates gamma random numbers with parameters A and B. Vector or matrix inputs for A and B must have the same size, which is also the size of R
. A scalar input for A or B is expanded to a constant matrix with the same dimensions as the other input.
R = gamrnd(A,B,m)
generates gamma random numbers with parameters A and B, where m is a 1-by-2 vector that contains the row and column dimensions of R.
R = gamrnd(A,B,m,n)
generates gamma random numbers with parameters A and B, where scalars m and n are the row and column dimensions of R.
Examples
n1 = gamrnd(1:5,6:10) n1 = 9.1132 12.8431 24.8025 38.5960 106.4164 n2 = gamrnd(5,10,[1 5]) n2 = 30.9486 33.5667 33.6837 55.2014 46.8265 n3 = gamrnd(2:6,3,1,5) n3 = 12.8715 11.3068 3.0982 15.6012 21.6739
See Also
gamcdf
, gamfit
, gaminv
, gamlike
, gampdf
, gamstat
![]() | gampdf | gamstat | ![]() |