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

apd_cdf(x,mu,sigma,p)
% invgausmix_cdf.m - compute Inverse Gaussian Mixture Cumulative Distribution Function.
%   See "Continuous Univaiate Distributions", Vol.1, Johnson, Kotz, & Balakrishnan,
%   J. Wiley, 1995, p.286.
%
%       Vector form of CDF!!!
%
%  Created by Jim Huntley,  11/06/08
%

function [cdf] = apd_cdf(x,mu,sigma,p)

tol = 1e-8;
trace = [];
warning off MATLAB:quad:MinStepSize;

minx = min(x);

% Integrate PDF to get CDF.
warning off MATLAB:quad:MinStepSize
for jz = 1:size(x,2)
    cdf(jz) = quad(@invgausmix_pdf,minx,x(jz),tol,trace,mu,sigma,p);
end

return



Contact us