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

dbtrlapl_cdf(x, P, Q)
% dbtrlapl_cdf.m - evaluates a Doubly Truncated Laplace Cumulative Distribution.
%   See "Continuous Univariate Distributions", Johnson, Kotz and Balakrishnan,
%   Vol.2, J. Wiley, 1995, p.171.
%
%  Created by Jim Huntley,  10/10/08
%

function [cdf] = dbtrlapl_cdf(x, P, Q)

%persistent coef xmin

%if(isempty(coef))
    coef = 0.5 / (1-P-Q);
    xmin = log(2*Q);
%end

if(x <= 0)
    cdf = coef * (exp(x) - exp(xmin));
elseif(x > 0)
    cdf = coef * (2 - exp(-x) - exp(xmin));
end

return


Contact us