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

mcleish_pdf(x, alpha, a)
% mcleisch_pdf.m - evaluates a Generalized McLeish Probability Density.
%   See "Dataplot, GMCCDF" 
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  5/25/06
%

function [pdf] = mcleish_pdf(x, alpha, a)

coef = (1-a^2)^alpha / (sqrt(pi)*gamma(alpha));
sx = size(x,2);
alpower = alpha - 0.5;

for jx = 1:sx
    absx = abs(x(jx));
    pdf(jx) = 0;
    if(absx ~= 0)
        pdf(jx) = coef .* exp(-a.*x(jx)) .* (0.5*absx).^alpower .* besselk(alpower,absx);       
    end
end

return

Contact us