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

disbesl_pdf(n, a, nu)
% disbesl_pdf.m - evaluates a Discrete Bessel Probability Density.
%   See "Univariate Discrete Distributions", Johnson, Kemp, and Kotz,
%   J. Wiley, p.495, 2005. 
%
%  Created by Jim Huntley,  12/13/06
%

function [pdf] = disbesl_pdf(n, a, nu)

%persistent loha lbesi

%if(isempty(loha))
    loha = log(0.5*a);
    lbesi = log(besseli(nu,a));
%end

%pdf = (0.5 * a)^(2*n+nu) / (besseli(nu,a) * factorial(n) * gamma(n+nu+1));
pdf = exp((2*n+nu)*loha - (lbesi + gammaln(n+1) + gammaln(n+nu+1)));

return


Contact us