<< distfun_exppdf Exponential distfun_expstat >>

Distfun >> Distfun > Exponential > distfun_exprnd

distfun_exprnd

Exponential random numbers

Calling Sequence

R = distfun_exprnd ( mu )
R = distfun_exprnd ( mu , v )
R = distfun_exprnd ( mu , m , n )

Parameters

mu :

a matrix of doubles, the average. Must be positive.

v :

a 1x2 or 2x1 matrix of doubles, the size of R

v(1) :

the number of rows of R

v(2) :

the number of columns of R

m :

a 1x1 matrix of floating point integers, the number of rows of R

n :

a 1x1 matrix of floating point integers, the number of columns of R

R:

a matrix of doubles, the random numbers.

Description

Generates random variables by inversion of the Beta cumulated probability distribution function.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

As a side effect, it modifies the internal seed of the grand function.

Notice that mu, the average, is the inverse of the rate. Other computing languages (including R), use 1/mu as the parameter of the exponential distribution.

Examples

// Set the seed so as to always get the same results.
distfun_seedset(1);

// Use R = distfun_exprnd ( mu )
distfun_exprnd(1:6)

// Check mean and variance for R = distfun_exprnd ( mu )
N = 1000;
for mu = 1:6;
computed = distfun_exprnd(mu,[1 N]);
disp(mu)
c = mean(computed)
e = mu
c = st_deviation(computed)
e = mu
end

// Check R = distfun_exprnd ( mu , v )
computed = distfun_exprnd(2,[1 5])
computed = distfun_exprnd(2,[3 2])

// Check mean and variance for R = distfun_exprnd ( a , b )
N = 1000;
mu = 2;
computed = distfun_exprnd(mu,[1 N]);
c = mean(computed(1:N) )
e = mu
c = st_deviation(computed(1:N) )
e = mu

// Check R = distfun_exprnd ( mu , m , n )
computed = distfun_exprnd([1 2 3;4 5 6],2,3)
computed = distfun_exprnd(2,2,3)
computed = distfun_exprnd(1,2,3)

// Check mean and variance for R = distfun_exprnd ( mu )
N = 1000;
mu = 2;
computed = distfun_exprnd(mu,1,N);
c = mean(computed(1:N) )
e = mu
c = st_deviation(computed(1:N) )
e = mu

// Make a plot of the actual distribution of the numbers
mu = 2;
data = distfun_exprnd(mu,1,1000);
histplot(10,data)
x = linspace(0,14,1000);
y = distfun_exppdf(x,mu);
plot(x,y)

Authors

<< distfun_exppdf Exponential distfun_expstat >>