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

gengauss_pdf(x, mu, sigma, p)
% gengauss_pdf.m - evaluates a Generalized Gaussian Probability Density.
%   See "A Practical Procedure to Estimate the Shape Parameter in the 
%   Generalized Gaussian Distribution", J. Armando Dominguez-Molina and 
%   R. M. Rodriguez-Dagnino, U. de Guanajuato.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  8/28/06
%

function [pdf] = gengauss_pdf(x, mu, sigma, p)

%persistent A coef

%if(isempty(A))
    A = sqrt(exp(2*log(sigma) + gammaln(1/p) - gammaln(3/p)));
    coef = exp(-(log(2) + gammaln(1+1/p) + log(A)));
%end

pdf = coef .* exp(-abs((x(jx)-mu)./A).^p);    

return

Contact us