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

tdexp_pdf(x, lambda, a, b)
% tdexp_pdf.m - evaluates a Truncated Double Exponential Probability denisity.
%   See "Applied Robust Statistics, Chapter 4, Truncated Distributions", 
%   D.J. Olive, http://www.math.siu.edu/olive/ch4.pdf.
%
%   Vector form of PDF!!!
%
%  Created by Jim Huntley,  01/11/10
%

function [pdf] = tdexp_pdf(x, lambda, a, b)

%persistent mu c coef

%if(isempty(coef))
    mu = 0.5 * (b-a) + a;
    c = (mu-a) / lambda;
    coef = 0.5 / ((1-exp(-c))*lambda);
%end

pdf = coef .* exp(-abs(x-mu)./lambda);

return





    

Contact us