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

ncchisqpr_cdf(x,lambd1,lambd2,nu1,nu2)
% ncchisqpr_cdf.m - compute Non-Central Chi-Square Product Cumulative Distribution Function.
%   See "Continuous Univariate Distributions", v.2, Johnson, Kotz, % Balakrishnan,
%   J. Wiley, p.472, 1996. 
%
%               Vector Form of CDF !!!
%
%  Created by:  Jim Huntley,  8/03/07.
%

function [cdf] = ncchisqpr_cdf(x,lambd1,lambd2,nu1,nu2)

% Integrate PDF to get CDF.
pdf = ncchisqpr_pdf(x,lambd1,lambd2,nu1,nu2);
sx = size(x,2);
for jx = 1:sx
    if(jx == 1)
        cdf(1) = pdf(1);
    elseif(jx == 2)
        cdf(2) = trapz(x(1:2)) * (x(2)-x(1));
    else
        cdf(jx) = simps(x(1:jx),pdf(1:jx));
    end
end

return



Contact us