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

tpnorm_cdf(x,tsi,sigma1,sigma2)
% tpnorm_cdf.m - evaluates a Two-Piece normal Cumulative Distribution.
%   See "Continuous Univariate Distributions", v.1, Johnson, Kotz, &,
%   Balakrishnan, Wiley, 1995, p.173.
%
%   Vector form of CDF!!!
%
%  Created by Jim Huntley,  01/08/10
%

function [cdf] = tpnorm_cdf(x,tsi,sigma1,sigma2)

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
    cdf(jz) = quad(@tpnorm_pdf,minx,x(jz),tol,trace,tsi,sigma1,sigma2);
end

return



Contact us