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

pert_pdf(x, mo, a, b)
% pert_pdf.m - evaluates a 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/09/11
%

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

%persistent mu a1 a2 coef

%if(isempty(coef) == 1)
    mu = (a + 4*mo + b) /6;
    a1 = 6*(mu-a)/(b-a);
    a2 = 6*(b-mu)/(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