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

fermi_pdf(x,s,mu)
% fermi_pdf.m - compute Fermi-Dirac Probability Density Function.
%               See Eric W. Weisstein. "Fermi-Dirac Distribution." 
%               From MathWorld--A Wolfram Web Resource. 
%               http://mathworld.wolfram.com/Fermi-DiracDistribution.html 
%
%               Vector Form of PDF !!!
%
%  Created by:  Jim Huntley,  03/11/04.
%

function [pdf] = fermi_pdf(x,s,mu)

%persistent coef

%if(isempty(coef))
    arg = exp(mu);
    coef = 1 / (arg * gamma(s+1) * lerch2(-arg,s+1,1));
%end

for jx = 1:size(x,2)
    pdf(jx) = coef * x(jx)^s / (exp(x(jx) - mu) + 1);
end

return

Contact us