Products & Services Solutions Academia Support User Community Company

Learn more about Statistics Toolbox   

gamrnd - Gamma random numbers

Syntax

R = gamrnd(A,B)
R = gamrnd(A,B,v)
R = gamrnd(A,B,m,n)

Description

R = gamrnd(A,B) generates random numbers from the gamma distribution with shape parameters in A and scale parameters in B. A and B can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input for A or B is expanded to a constant array with the same dimensions as the other input.

R = gamrnd(A,B,v) generates random numbers from the gamma distribution with parameters A and B, where v is a row vector. If v is a 1-by-2 vector, R is a matrix with v(1) rows and v(2) columns. If v is 1-by-n, R is an n-dimensional array.

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

randg, random, gampdf, gamcdf, gaminv, gamstat, gamfit, gamlike

Gamma Distribution

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS