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

betadiff_cdf(x,p1,q1,p2,q2)
% betadiff_cdf.m - compute beta difference Cumulative Distribution Functions.
%   See "Continuous Univariate Distributions", Johnson, Kotz, and
%   Balakrishnan, V2, J. Wiley, , p.263, 1996.               
%
%               Vector Form of CDF !!!
%
%  Created by:  Jim Huntley,  10/30/06.
%

function [cdf] = betadiff_cdf(x,p1,q1,p2,q2)

% Integrate PDF to get CDF.

dx = x(2) - x(1);
pdf = betadiff_pdf(x,p1,q1,p2,q2);
sz = size(x,2);
for jz = 1:sz
    if(jz <= 2)
        cdf(jz) = trapz(pdf(1:jz)) * dx;
    elseif(jz > 2)
        cdf(jz) = simps(pdf(1:jz)) * dx;
    end
end

return



Contact us