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

cox2_cdf(x,p,lambda1,lambda2)
% cox2_cdf.m - evaluate a Coxian-2 Cumulative Distribution Function.
%   See "A Simple Approximation to a Renewal Function", E. Smeltink and
%   R. Dekker, Free U., IEE Trans. on Reliability, Vol. 39, No. 1, April, 1990.
%
%   Created by:  Jim Huntley,  10/09/06.
%

function [cdf] = cox2_cdf(x,p,lambda1,lambda2)

if(lambda1 == lambda2)    
    cdf = 1 + (lambda1.*x.*(p-1) - 1) .* exp(-lambda1.*x);
else    
    cdf = 1 - (p.*lambda1-lambda2) .* exp(-lambda1.*x) ./ (lambda1-lambda2) - ...
          (1 -(p.*lambda1-lambda2)./(lambda1-lambda2)) .* exp(-lambda2.*x);
end

return

Contact us