Generation of Random Variates
09 Feb 2012
generates random variates from over 870 univariate distributions
%irwinhall_pdf.m - evaluates an Irwin Hall Probability Density Distribution.
% "Continuous Univariate Distributions", v.2, Johnson, Kotz, and Balakrishnan,
% Wiley, 1996, p. 296 (with modifications for normalization).
% Created by: J. Huntley, 06/12/07
function[pdf] = irwinhall_pdf(x,a,k)
n = k + 1;
coef = (log(n) - n*log(a));
for jx = 1:size(x,2)
sum1 = 0;
for jj = 1:k+1
sum1 = sum1 + (-1)^(jj-1) * binomial_coef(n,jj-1) * (x(jx)-a*(jj-1))^k;
pdf(jx) = exp(coef + log(sum1+eps));