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

modpert_pdf(x, gam, mo, a, b)
% modpert_pdf.m - evaluates a Modified PERT Probability Density.
%   See "A Compendium of Distributions", ModelRisk 3.0, Vose Software,
%   http://www.vosesoftware.com/content/ebook.pdf.
%
%  Created by Jim Huntley,  08/11/11
%

function [pdf] = modpert_pdf(x, gam, mo, a, b)

%persistent coef a1 a2

%if(isempty(coef))
    a1 = 1 + gam*(mo-a)/(b-a);
    a2 = 1 + gam*(b-mo)/(b-a);
    coef = 1 / (beta(a1,a2)*(b-a)^(a1+a2-1));
%end

pdf = coef .* (x-a).^(a1-1) .* (b-x).^(a2-1);

return

Contact us