Generation of Random Variates
09 Feb 2012
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
coef = 0.5 / (1-P-Q);
xmin = log(2*Q);
if(x <= 0)
cdf = coef * (exp(x) - exp(xmin));
elseif(x > 0)
cdf = coef * (2 - exp(-x) - exp(xmin));