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

nakagami_pdf(x, a, b, c)
% Nakagami_pdf.m evaluates a Nakagami Probability Distribution.
%  "Performance of three different Estimators for for the Nakagami m parameter
%   Using Monte Carlo Simulation", A. Abdi & M. Kaveh. 
%
%  Created by Jim Huntley,  05/29/02
%

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

%persistent gamc l2 lb clc

%if(isempty(gamc))
    gamc = gammaln(c);
    l2 = log(2);
    lb = log(b);
    clc = c*log(c);
%end

%pdf = (2 / (b*gamma(c))) * c^c * ((x-a)/b)^(2*c-1) * exp(-c*((x-a)/b)^2);
pdf =  exp(l2 - (lb + gamc) + clc + log(((x-a)/b)^(2*c-1)) + (-c*((x-a)/b)^2));

return

Contact us