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

gent2_cdf(x,p,q)
% gent2_cdf.m - compute Generalized T Cumulative Distribution Function.             
% See "Continuous Univariate Distributions", Johnson, Kotz, & Balakrishnan,
% Wiley, Vol. 2, p. 421, 1995.
%
%  Created by:   Jim Huntley,  02/14/07.
%
%  Vector form of the CDF !!!
%

function [cdf] = gent2_cdf(x,p,q)

tol = 1e-8;
trace = [];
warning off MATLAB:quad:MinStepSize;

minx = min(x);

% Integrate PDF to get CDF.
warning off MATLAB:quad:MinStepSize
sz = size(x,2);
for jz = 1:sz
    qz(jz) = quad(@gent2_pdf,minx,x(jz),tol,trace,p,q);
end

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

return



Contact us