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

modnorm_pdf(x, a, sigma)
% modnorm_pdf.m - evaluates a Modified Normal Probability Density.
%   See "Continuous Univariate Distributions", v.1, Johnson, Kotz, & Balakrishnan, 
%   J. Wiley, 1995, p.172.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  7/12/07
%

function [pdf] = modnorm_pdf(x, a, sigma)

%persistent coef

%if(isempty(coef))
    coef = (a+1) / (sqrt(2*pi)*sigma);
%end

nt = 500;
dt = (1-eps) / (nt-1);
t = eps:dt:1;

for jx = 1:size(x,2)
    kern = t.^(a-0.5) .* exp(-0.5.*x(jx).^2./(t.*sigma^2));
    pdf(jx) = coef * simps(kern) * dt;
end
    
return

Contact us