Section: Random Number Generation
y = randgamma(a,r),
where a
and r
are vectors describing the parameters of the
gamma distribution. Roughly speaking, if a
is the mean time between
changes of a Poisson random process, and we wait for the r
change,
the resulting wait time is Gamma distributed with parameters a
and r
.
r
-th event in a process with
mean time a
between events. The probability distribution of a Gamma
random variable is
Note also that for integer values of r
that a Gamma random variable
is effectively the sum of r
exponential random variables with parameter
a
.
randgamma
function to generate Gamma-distributed
random variables, and then generate them again using the randexp
function.
--> randgamma(1,15*ones(1,9)) ans = <float> - size: [1 9] Columns 1 to 6 22.780443 11.551359 16.853683 12.745702 16.230314 10.744172 Columns 7 to 9 19.394232 16.361151 17.477238 --> sum(randexp(ones(15,9))) ans = <float> - size: [1 9] Columns 1 to 6 14.6404095 15.1859598 13.3146982 11.4380150 7.2307277 10.8224525 Columns 7 to 9 14.5270958 12.4630632 11.8753099