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

champer4p_cdf(x, sigma, theta, alpha, t0)
% champer4p_cdf.m - tests a Champernowne 4-paramater Cumulative Distribution.
%   See "Continuous Univariate Distributions", Vol.1, Johson, Kotz, and Balakrishnan,
%   J. Wiley, 1995, p. 611.
%
%   Created by: J. Huntley,  10/02/08   
%

function[cdf] = champer4p_cdf(x, sigma, theta, alpha, t0)

for jx = 1:size(x,2)
    argy = sin(theta);
    if(x(jx) <= t0)
    argx = (cos(theta)+(x(jx)/t0)^(sigma*alpha));    
    cdf(jx) = 1 - ((sigma-1)*theta + 2*atan2(argy,argx)) / ((1+sigma)*theta);
    elseif(x(jx) > t0)
    argx = (cos(theta)+(x(jx)/t0)^alpha);      
    cdf(jx) = 1 - (2*sigma*atan2(argy,argx)) / ((1+sigma)*theta);
    end
end

return

Contact us