Code covered by the BSD License  

Highlights from
Generation of Random Variates

image thumbnail

Generation of Random Variates

by

 

generates random variates from over 870 univariate distributions

landau_pdf(lambda);
% landau_pdf.m - evaluates a Landau Probability Density.
%   See "DePAC Tutorials," Universitat Siegen, C. Grupen, 21/01/2000.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  7/25/05
%

function [pdf] = landau_pdf(lambda);

tol = 1e-6;
trace = [];
sx = size(lambda,2);
warning off MATLAB:quad:MinStepSize;
for jx = 1:sx
    lam = lambda(jx);
    % Integrate kernel function to get PDF.
    %pdf(jx) = quad(@landau,eps,10,tol,trace,lam) / pi;
    % Integral appears to have singularity.  Use approximate PDF.
    pdf(jx) = exp(-0.5*(lam + exp(-lam))) / sqrt(2*pi);
end

return

Contact us