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

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

function[pdf] = champer4p_pdf(x, sigma, theta, alpha, t0)

for jx = 1:size(x,2)
    if(x(jx) <= t0)
    pdf(jx) = 2*sin(theta)*(x(jx)/t0)^(sigma*alpha)*sigma*alpha/x(jx)/(2*cos(theta)*(x(jx)/t0)^(sigma*alpha) + ...
              (x(jx)/t0)^(2*sigma*alpha)+1)/(1+sigma)/theta;  
    elseif(x(jx) > t0)
    pdf(jx) = 2*sigma*sin(theta)*(x(jx)/t0)^alpha*alpha/x(jx)/(2*cos(theta)*(x(jx)/t0)^alpha + ...
              (x(jx)/t0)^(2*alpha)+1)/(1+sigma)/theta;      
    end
end

return

Contact us