Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

chisq_cdf(x, nu)
%Chisq_cdf.m evaluates a Chi-squared Cumulative Distribution.
%   See "Dataplot Reference Manual, CHSCDF", 8-35, NIST, 3/20/97
%  Created by Jim Huntley,  10/10/03

function [cdf] = chisq_cdf(x, nu)

%persistent coef

    coef = gammaln(0.5*nu);

%cdf = gammainc(x/(2*sigmasq),nud2) / gamma(nud2);
cdf = exp(log(max(eps,(gammainc(0.5*x,0.5*nu)))) - coef);


Contact us