Home > wafo > wstats > wraylrnd.m

wraylrnd

PURPOSE ^

Random matrices from a Rayleigh distribution

SYNOPSIS ^

R = wraylrnd(b,varargin);

DESCRIPTION ^

 WRAYLRND Random matrices from a Rayleigh distribution
  
  CALL:  R = wraylrnd(b,sz)
      
         R = matrix of random numbers
         b = parameter
        sz = size(R)    (Default size(b))
             sz can be a comma separated list or a vector 
             giving the size of R (see zeros for options).
 
  The Rayleigh distribution is defined by its cdf
 
   F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0
 
  The random numbers are generated by the inverse method. 
 
  Example:
    R=wraylrnd(2,1,100);
    wraylplot(R);
 
  See also  wraylinv

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function R = wraylrnd(b,varargin);
002 %WRAYLRND Random matrices from a Rayleigh distribution
003 % 
004 % CALL:  R = wraylrnd(b,sz)
005 %     
006 %        R = matrix of random numbers
007 %        b = parameter
008 %       sz = size(R)    (Default size(b))
009 %            sz can be a comma separated list or a vector 
010 %            giving the size of R (see zeros for options).
011 %
012 % The Rayleigh distribution is defined by its cdf
013 %
014 %  F(x;b) = 1 - exp(-x^2/(2b^2)), x>=0
015 %
016 % The random numbers are generated by the inverse method. 
017 %
018 % Example:
019 %   R=wraylrnd(2,1,100);
020 %   wraylplot(R);
021 %
022 % See also  wraylinv
023 
024 % Reference: Cohen & Whittle, (1988) "Parameter Estimation in Reliability
025 % and Life Span Models", p. 181 ff, Marcel Dekker.
026 
027 
028 % Tested on: Matlab 5.3
029 % History: 
030 % revised PJ 03-Apr-2001
031 %  - added comnsize, nargchk
032 %  - made sizing of R more flexible
033 % revised jr 22.11.2000
034 % - 'reshape' introduced to obtain wanted dimension of output 
035 % added ms 15.06.2000
036 
037 error(nargchk(1,inf,nargin))
038 if nargin>1,
039  [errorcode b]=comnsize(b,zeros(varargin{:}));
040  if errorcode
041    error('b must be a scalar or comply to the size info given.');
042  end
043 end
044 
045 %if nargin==1,
046 % m=1;n=1;
047 %end
048 
049 R = wraylinv(rand(size(b)),b);
050 %R = reshape(wraylinv(rand(m,n),b),m,n);
051 
052

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