Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

beta(z,w,v)
function y = beta(z,w,v)
%BETA   Beta function.
%   Y = BETA(Z,W) computes the beta function for corresponding
%   elements of Z and W.  The beta function is defined as
%
%   beta(z,w) = integral from 0 to 1 of t.^(z-1) .* (1-t).^(w-1) dt.
%
%   The arrays Z and W must be the same size (or either can be
%   scalar).
%
%   See also BETAINC, BETALN.

%   C. Moler, 2-1-91.
%   Ref: Abramowitz & Stegun, sec. 6.2.
%   Copyright 1984-2001 The MathWorks, Inc. 
%   $Revision: 5.8 $  $Date: 2001/04/15 12:01:42 $

if nargin<2,
  error('Not enough input arguments.');
elseif nargin == 2
    y = exp(gammaln(z)+gammaln(w)-gammaln(z+w));
elseif nargin == 3
    warning(sprintf([ ...
    'This usage of beta(x,z,w) is obsolete and will be eliminated\n' ...
    '         in future versions.  Please use BETAINC(X,Z,W) instead.']));
    y = betainc(z,w,v);
end

Contact us