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

genbeta4p_cdf(x, a, b, c, d)
% genbeta4p_cdf.m - evaluates a Generalized Beta 4-Parameter Cumulative Distribution.
%   See "Handbook of Beta Distribution and Its Applications", A.K Gupta &,
%   S. Nadarajah, p.116, 2004.  
%
%  Created by Jim Huntley,  09/30/11
%

function [cdf] = genbeta4p_cdf(x, a, b, c, d)

pdf = genbeta4p_pdf(x, a, b, c, d);
dx = x(2) - x(1);
sx = size(x,2);
for jx = 1:sx
    if(jx <= 2)
        cdf(jx) = trapz(pdf(1:jx)) * dx;
    elseif(jx > 2)
        cdf(jx) = simps(pdf(1:jx)) * dx;
    end
end

return

Contact us