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

mckay2_pdf(x, a, b, c)
% mckay2_pdf.m - evaluates a McKay II Probability Density.
%   See "Sum & Difference of 2 Squared Correlated Nakagami Variates
%   in Connection with the McKay Distribution", H. Holm & M-S Alouini,
%   IEEE Trans. Comm., Vol. 52, No. 8, August 2004, p. 1368.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  03/31/05
%

function [pdf] = mckay2_pdf(x, a, b, c)

D = (1 - c^2)^(a+0.5) / (sqrt(pi) * 2^a * b * gamma(a+0.5));

for jx = 1:size(x,2);
    if(abs(x(jx)) < eps)
        x(jx) = eps;
    end
end

arg = x ./ b;
pdf = D .* abs(arg).^a .* exp(-c.*arg) .* besselk(a,abs(arg));

return

Contact us