Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

chaudhry_cdf(x, alpha, bet)
% chaudhry_cdf.m - tests a Chaudhry & Ahmad Cumulative Distribution.
%   See "Continuous Univariate Distributions", Vol.2, Johnson, Kotz, & Balakhrishnan,
%   J. Wiley, 1995, p.662.
%
%   Created by: J. Huntley, 10/02/08.
%

function[cdf] = chaudhry_cdf(x, alpha, bet)

%persistent rtalph rtbet rtab

%if(isempty(rtab))
    rtalph = sqrt(alpha);
    rtbet = sqrt(bet);
    rtab = rtalph*rtbet;
%end

cdf = 0.5 * (exp(2*rtab)*(exp(2*rtab)*erf((x^2*rtalph+rtbet)/x)+ ...
      exp(-2*rtab)*erf((x^2*rtalph-rtbet)/x)) - exp(4*rtab)) + 0.5;

return

Contact us