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

genk_pdf(x, alpha, eta, nu)
% genk_pdf.m - evaluates a Generalized K Probability Density.
%   See "The K-Generalized Model to Generate Marine Feature in SAR Images: First Results", 
%   M. Migliaccio et al., U. di Napoli, Proc. of SEASAR, 2006, 23 Jan., 2006, ESA SP-613, April, 2006.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  9/18/06
%

function [pdf] = genk_pdf(x, alpha, eta, nu)

%persistent term coef

%if(isempty(term))
    term = (1+0.25*nu^2/alpha);
    coef = exp(log(2 * alpha * (alpha/term)^(0.5*(alpha-1))) - ...
           (gammaln(alpha) + log(eta^(alpha+1))));
%end

for jx = 1:size(x,2)
    pdf(jx) = coef * x(jx)^(0.5*(alpha-1)) * besseli(0,nu*sqrt(x(jx))/eta) * ...
              besselk(alpha-1,2*(sqrt(term*alpha*x(jx)))/eta); 
end

return

Contact us