Home > wafo > wstats > wexprnd.m

# wexprnd

## PURPOSE

Random matrices from an Exponential distribution

## SYNOPSIS

R = wexprnd(m0,varargin);

## DESCRIPTION

``` WEXPRND Random matrices from an Exponential distribution

CALL:  R = wexprnd(m0,sz)

R = matrix of random numbers
m0 = mean of the Exponential distribution, m0>0
sz = size(R)    (Default size(m0))
sz can be a comma separated list or a vector
giving the size of R (see zeros for options).

The random numbers are generated by the inverse method.

Example:
R=wexprnd(5,1,100);
phat=wweibplot(R)     % Exp is Weibull with c=1

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wexpinv Inverse of the Exponential distribution function error Display message and abort function.
This function is called by:
 tpextrapolate Extrapolates a sequence of turning points.

## SOURCE CODE

```001 function R = wexprnd(m0,varargin);
002 %WEXPRND Random matrices from an Exponential distribution
003 %
004 % CALL:  R = wexprnd(m0,sz)
005 %
006 %        R = matrix of random numbers
007 %       m0 = mean of the Exponential distribution, m0>0
008 %       sz = size(R)    (Default size(m0))
009 %            sz can be a comma separated list or a vector
010 %            giving the size of R (see zeros for options).
011 %
012 % The random numbers are generated by the inverse method.
013 %
014 % Example:
015 %   R=wexprnd(5,1,100);
016 %   phat=wweibplot(R)     % Exp is Weibull with c=1
017 %
019
020 % Reference: Johnson, Kotz and Balakrishnan (1994)
021 % "Continuous Univariate Distributions, vol. 1", p. 494 ff
022 % Wiley
023
024 % Tested on: Matlab 5.3
025 % History:
026 % revised pab 24.10.2000
027 %  - added comnsize, nargchk
028 %  - made sizing of R more flexible
030
031 error(nargchk(1,inf,nargin))
032 if nargin>1,
033  [errorcode m0]=comnsize(m0,zeros(varargin{:}));
034  if errorcode
035    error('m0 must be a scalar or comply to the size info given.');
036  end
037 end
038
039 R = wexpinv(rand(size(m0)),m0);
040
041```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003