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

pearson2_cdf(x,a,b);
% pearson2_cdf.m - evaluates a Pearson II Cumulative Distribution.
%   See "Non-Uniform Random Deviates", L. Devroye, Chapter 9.
%
%  Created by Jim Huntley,  08/18/06
%
%

function [cdf] = pearson2_cdf(x,a,b);

tol = 1e-8;
trace = [];
warning off MATLAB:quad:MinStepSize;
minx = min(x);

warning off MATLAB:quad:MinStepSize
sz = size(x,2);

for jx = 1:sz
    qz(jx) = quad(@pearson2_pdf,minx,x(jx),tol,trace,a,b);
end

% Normalize CDF.
cdf = qz./max(qz);

return

Contact us