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

dbtrinvgaus_cdf(x,lambda,mu,x1,x2)
% dbtrinvgaus_cdf.m - compute Doubly Truncated Inverse Gaussian Cumulative Distribution Function.
%   See "Continuous Univariate Distributions", Johnson, Kotz and Balakrishnan,
%   Vol.1, J. Wiley, 1995, p.277.               
%
%               Vector Form of CDF !!!
%
%  Created by:  Jim Huntley,  10/10/08.
%

function [cdf] = dbtrinvgaus_cdf(x,lambda,mu,x1,x2)

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(@dbtrinvgaus_pdf,minx,x(jz),tol,trace,lambda,mu,x1,x2);
end

return



Contact us