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

trundexp_cdf(x, mu, lambda, k);
% trundexp_cdf.m - evaluates the Truncated Double Exponential Cumulative Distribution.  
% See "http://www.math.siu.edu/olive/
% ch4.pdf#search=%22%22chapter%204%22%20%2B%22truncated%20Distributions%22%22" 
%
% Created by:   Jim Huntley,  08/22/02.
%

function [cdf] = trundexp_cdf(x, mu, lambda, k);

c = k * log(2);
coef = lambda / (2*lambda*(1-exp(-c)));
if((x-mu) >= 0)
    cdf = coef*((1 - exp(-(x-mu)/lambda)) + 1 - exp(-c));
elseif((x-mu) < 0)
    cdf = coef*(exp((x-mu)/lambda) - exp(-c));
end

return

Contact us