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

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

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

sz = size(x,2);
pdf = truncig_pdf(x,lambda,mu,x1,x2);
for jz = 1:sz
    if(jz < 3)
        cdf(jz) = trapz(pdf(1:jz));
    elseif(jz >= 3)
        cdf(jz) = simps(pdf(1:jz));
    end
end

return



Contact us