Home > wafo > wstats > walpharnd.m

walpharnd

PURPOSE ^

Random matrices from a symmetric alpha-stable distribution

SYNOPSIS ^

R = walpharnd(a,varargin);

DESCRIPTION ^

 WALPHARND Random matrices from a symmetric alpha-stable distribution
  
  CALL:  R = walpharnd(a,sz);
 
         R = matrix of random numbers, 
         a = the parameter  alpha, 
        sz = size(R)    (Default size(a))
             sz is a comma separated list or a vector 
             giving the size of R (see zeros for options).
 
  The characteristic function of a symmetric alpha-stable distribution is
    h(t) = exp(-abs(t)^a)
  a = 1 gives the Cauchy distribution and a = 2 the Gaussian distribution.
 
  Example:
    R=walpharnd(0.5,1,100);
    plot(R,'.')
    R=walpharnd(2,1,100);
    wnormplot(R)
  
  See also  zeros

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function R = walpharnd(a,varargin);
002 %WALPHARND Random matrices from a symmetric alpha-stable distribution
003 % 
004 % CALL:  R = walpharnd(a,sz);
005 %
006 %        R = matrix of random numbers, 
007 %        a = the parameter  alpha, 
008 %       sz = size(R)    (Default size(a))
009 %            sz is a comma separated list or a vector 
010 %            giving the size of R (see zeros for options).
011 %
012 % The characteristic function of a symmetric alpha-stable distribution is
013 %   h(t) = exp(-abs(t)^a)
014 % a = 1 gives the Cauchy distribution and a = 2 the Gaussian distribution.
015 %
016 % Example:
017 %   R=walpharnd(0.5,1,100);
018 %   plot(R,'.')
019 %   R=walpharnd(2,1,100);
020 %   wnormplot(R)
021 % 
022 % See also  zeros
023 
024 % Reference:
025 % Samordnitsky & Taqqu (1994) "Non-Gaussian and Stable Processes"
026 % Chapman & Hall
027 
028 % Tested on: Matlab 5.3
029 % History: 
030 % Revised by jr 22.12.1999
031 % revised ms 15.06.2000
032 % - updated header info
033 % - changed name to walpharnd (from alpharnd)
034 % - rewrote code to work with matrices
035 % revised pab 23.10.2000
036 %  - added comnsize, nargchk
037 %  - added greater flexibility on the sizing of R
038 
039 error(nargchk(1,inf,nargin))
040 if nargin>1,
041   [errorcode a ] = comnsize(a,zeros(varargin{:}));
042   if errorcode > 0
043     error('a  must be  scalar or conform to the size information given.');
044   end
045 end
046 
047 csiz=size(a);
048 Y1=-log(rand(csiz));
049 Y2=pi*(rand(csiz)-0.5);
050 
051 R=sin(a.*Y2)./cos(Y2).^(1./a).*(cos((1-a).*Y2)./Y1).^((1-a)./a);
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