Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

James Huntley (view profile)

 

generates random variates from over 870 univariate distributions

gig_pdf(x, a, b, p)
% gig_pdf.m - evaluates a Generalized Inverse Gaussian Probability Density.
%   See "Generalized Inverse Gaussian Distribution", Wikipedia
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  7/19/06
%

function [pdf] = gig_pdf(x, a, b, p)

%persistent c1

%if(isempty(c1))
    c1 = 0.5 * (a/b)^(0.5*p) / besselk(p,sqrt(a*b));
%end

pdf = c1 .* x.^(p-1) .* exp(-0.5.*(a.*x+b./x));


return

Contact us