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

kprime_pdf(x, alpha, bet, N)
% kprime_pdf.m - evaluates a K0 Probability Density.
%   See "Multiply Stochastic Representations for K Distributions and
%   thier Poisson Transforms", M. C. Teich and P. Diament,
%   J. Opt. Soc. Am., v.6, No.1, Jan., 1989.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  7/31/07
%

function [pdf] = kprime_pdf(x, alpha, bet, N)

%persistent coef abdN

%if(isempty(coef))
    abdN = alpha * bet / N;
    coef = exp(log(2*abdN) - (gammaln(alpha) + gammaln(bet)));
%end

arg = abdN .* x;
pdf = coef .* arg.^(0.5*(alpha+bet)-1) .* besselk(alpha-bet,2.*sqrt(arg));    

return

Contact us