Home > wafo > wstats > wbetarnd.m

# wbetarnd

## PURPOSE

Random matrices from a Beta distribution

## SYNOPSIS

R = rbeta(a,b,varargin)

## DESCRIPTION

``` WBETARND  Random matrices from a Beta distribution

CALL:  R =wbetarnd(a,b,sz)

R = matrix of random numbers
a, b = parameters
sz = size(R)    (Default size(a))
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=wbetarnd(4,4,40);
plot(R,'.')```

## CROSS-REFERENCE INFORMATION

This function calls:
 comnsize Check if all input arguments are either scalar or of common size. wbetainv Inverse of the Beta distribution function error Display message and abort function.
This function is called by:
 wfrnd Random matrices from the Snedecor's F distribution

## SOURCE CODE

```001 function R = rbeta(a,b,varargin)
002 %WBETARND  Random matrices from a Beta distribution
003 %
004 % CALL:  R =wbetarnd(a,b,sz)
005 %
006 %       R = matrix of random numbers
007 %    a, b = parameters
008 %      sz = size(R)    (Default size(a))
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=wbetarnd(4,4,40);
016 %   plot(R,'.')
017
018
019 %       Anders Holtsberg, 18-11-93
020 %       Copyright (c) Anders Holtsberg
021
022
023
024
025 error(nargchk(2,inf,nargin))
026 if nargin<3,
027   [errorcode a b] = comnsize(a,b);
028 else
029   [errorcode a b] = comnsize(a,b,zeros(varargin{:}));
030 end
031 if errorcode > 0
032   error('df1 and df2 must be a scalar or of corresponding size as given by m and n.');
033 end
034
035 csiz=size(a);
036 R = wbetainv(rand(csiz),a,b);
037
038
039
040```

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