Home > wafo > wstats > wlognrnd.m

# wlognrnd

## PURPOSE

Random matrices from a Lognormal distribution.

## SYNOPSIS

R = wlognrnd(mu,v,varargin);

## DESCRIPTION

``` WLOGNRND Random matrices from a Lognormal distribution.

CALL:  R = wlognrnd(mu,v,sz);

mu, v = parameters (see wlognpdf) (Default 0 and 1, respectively)
sz = size(R)    (Default common size of mu and v)
sz can be a comma separated list or a vector
giving the size of R (see zeros for options).
Example:
R = wlognrnd(1,2,100,2);
wnormplot(log(R))

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wnormrnd Random matrices from a Normal distribution. error Display message and abort function.
This function is called by:
 dist2drnd Random points from a bivariate DIST2D distribution mdist2drnd Random points from a bivariate MDIST2D distribution mk87rnd Random points from MK87 distribution of steepness and wave height.

## SOURCE CODE

```001 function R = wlognrnd(mu,v,varargin);
002 %WLOGNRND Random matrices from a Lognormal distribution.
003 %
004 % CALL:  R = wlognrnd(mu,v,sz);
005 %
006 %     mu, v = parameters (see wlognpdf) (Default 0 and 1, respectively)
007 %        sz = size(R)    (Default common size of mu and v)
008 %             sz can be a comma separated list or a vector
009 %             giving the size of R (see zeros for options).
010 % Example:
011 %   R = wlognrnd(1,2,100,2);
012 %   wnormplot(log(R))
013 %
015
016 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
017 % and Life Span Models", p. 59 ff, Marcel Dekker.
018
019
020
021 % Tested on; Matlab 5.3
022 % History:
023 % revised pab 23.10.2000
024 %  - added comnsize, nargchk
025 %  - added greater flexibility on the sizing of R
027
028
029 error(nargchk(2,inf,nargin))
030 if nargin<1|isempty(mu),mu=0;end
031 if nargin<2|isempty(v), v=1;end
032
033 if nargin<3,
034   [errorcode mu v] = comnsize(mu,v);
035 else
036   [errorcode mu v] = comnsize(mu,v,zeros(varargin{:}));
037 end
038 if errorcode > 0
039     error('mu and v must be of common size or scalar.');
040 end
041
042 R = exp(wnormrnd(mu,v));
043
044```

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