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

invgaus_cdf(x, gam, mu)
% invgaus_cdf.m - evaluates a Cumulative Inverse Gaussian Distribution.
%   See "Dataplot Reference Manual, IGCDF", 8-125, NIST, 3/20/97.
%
%  Created by Jim Huntley,  11/20/03
%
%

function [cdf] = invgaus_cdf(x, gam, mu)

arg1 = sqrt(gam/x) * (x/mu-1);
arg2 = -sqrt(gam/x) * (x/mu+1);
phi1 = (erf(arg1/sqrt(2)) + 1) / 2;			% Normal CDF of 'arg1'.
phi2 = (erf(arg2/sqrt(2)) + 1) / 2; 		% Normal CDF of 'arg2'.
cdf = phi1 - phi2*exp(2*gam/mu);

return

Contact us