Home > wafo > wstats > wweibrnd.m

# wweibrnd

## PURPOSE

Random matrices a the Weibull distribution.

## SYNOPSIS

R = wweibrnd(a,c,varargin)

## DESCRIPTION

``` WWEIBRND Random matrices a the Weibull distribution.

CALL:  R = wweibrnd(a,c,sz)

R     = a matrix of random numbers from the Weibull distribution
a, c  = parameters of the Weibull distribution
sz = size(R)    (Default common size of k,s and m0)
sz can be a comma separated list or a vector
giving the size of R (see zeros for options).

The Weibull distribution is defined by the distribution function

F(x) = 1 - exp(-(x/a)^c), x>=0, a,b>0

The random numbers are generated by the inverse method.

Example:
R=wweibrnd(1,10,1,100);
phat=wweibplot(R)

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wweibinv Inverse of the Weibull distribution function 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. weib2drnd Random numbers from the 2D Weibull distribution.

## SOURCE CODE

```001 function R = wweibrnd(a,c,varargin)
002 %WWEIBRND Random matrices a the Weibull distribution.
003 %
004 % CALL:  R = wweibrnd(a,c,sz)
005 %
006 % R     = a matrix of random numbers from the Weibull distribution
007 % a, c  = parameters of the Weibull distribution
008 %    sz = size(R)    (Default common size of k,s and 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 Weibull distribution is defined by the distribution function
013 %
014 %   F(x) = 1 - exp(-(x/a)^c), x>=0, a,b>0
015 %
016 % The random numbers are generated by the inverse method.
017 %
018 % Example:
019 %   R=wweibrnd(1,10,1,100);
020 %   phat=wweibplot(R)
021 %
023
024 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
025 % and Life Span Models", p. 25 ff, Marcel Dekker.
026
027
028 % Tested on: matlab 5.3
029 % History:
030 % revised pab 23.10.2000
032 %  - added greater flexibility on the sizing of R
033 % rewritten ms 15.06.2000
034
035 error(nargchk(2,inf,nargin))
036 if nargin==2,
037   [errorcode a c] = comnsize(a,c);
038 else
039   [errorcode a c] = comnsize(a,c,zeros(varargin{:}));
040 end
041 if errorcode > 0
042     error('a and c must be of common size or scalar.');
043 end
044 csiz=size(a);
045 R = wweibinv(rand(csiz),a,c);
046
047
048
049
050
051```

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