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

pearson3_pdf(x, lambda, beta, epsilon)
% pearson3_pdf.m - evaluates the Pearson 3 Probability Density Function.  
%                  See "Methodes Probabilisties en Genie Civil", Chap. 6..
%                  Vector Form!
%
%   Created by Jim Huntley,  03/02/05
%

function [pdf] = pearson3_pdf(x, lambda, beta, epsilon)

%persistent gamlnbet t1

%if(isempty(t1))
    t1 = log(lambda^beta);
    gamlnbet = gammaln(beta);
%end

for jx = 1:size(x,2)
  if (x(jx) <= epsilon) 
    pdf(jx) = 0;
  else
    %pdf(jx) = lambda^beta * (x(jx) - epsilon)^(beta-1) * exp(-lambda*(x(jx) - epsilon)) / gamma(beta);  
    pdf(jx) = exp(t1 + log((x(jx) - epsilon)^(beta-1)) + (-lambda*(x(jx) - epsilon)) - gamlnbet);
  end
end

return

Contact us