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

cox2_pdf(x, p, lambda1, lambda2)
% cox2_pdf.m - evaluate a Coxian-2 Probability Density 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 [pdf] = cox2_pdf(x, p, lambda1, lambda2)

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

return

Contact us