gamrnd

Generate random data from a gamma distribution.

Syntax

rnd=gamrnd(a,b)

rnd=gamrnd(a,b,r,c)

Inputs

a
Shape parameter.
Type: double
Dimension: scalar | vector | matrix
b
Scale parameter.
Type: double
Dimension: scalar | vector | matrix
r,c
Number of matrix rows and columns.
Type: integer
Dimension: scalar

Outputs

rnd
Random data.

Examples

Single value gamrnd example:
a = 10;
b = 0.5;
rnd = gamrnd(a,b)
rnd = 4.2942
Vector gamrnd example:
a = 10;
b = 0.5;
r = 1;
c = 5;
rnd = gamrnd(a,b,r,c)
rnd = [Matrix] 1 x 5
4.2942 4.1324 4.7928 3.8666 3.2519

Comments

The random number generator can be initialized using rand.