Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates


James Huntley (view profile)


generates random variates from over 870 univariate distributions

meixner_pdf(x, a, b, d, m)
% meixner_pdf.m - evaluates a Meixner Probability Density.
%   See "Some Aspects of Levy Processes in Finance", J. Tykesson, 8/30/03.
%  Created by Jim Huntley,  8/24/04

function [pdf] = meixner_pdf(x, a, b, d, m)

%persistent t1 t2 gamln2d

    t1 = log((2*cos(b/2)).^(2.*d));
    t2 = log(2*a*pi);
    gamln2d = gammaln(2*d);

%pdf = (2*cos(b/2)).^(2.*d) .* exp(b.*(x-m)/a) .* (abs(cgamma(d+i.*(x-m)./a))).^2 ./ (2*a*pi*gamma(2*d));
pdf = exp(t1 + (b.*(x-m)/a) + log((abs(cgamma(d+i.*(x-m)./a))).^2) - (t2 + gamln2d)); 


Contact us