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

multout_pdf(x, xmin, psi0, xmax)
% multout_pdf.m - evaluates a Multiplier Output Probability Density.
%   See "The Probability Distribution for the Filtered Output 0f a Multiplier ...",
%   D.G. Lampard, IRE Trans. Information Theory, March, 1956, p.4.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  3/30/05
%

function [pdf] = multout_pdf(x, xmin, psi0, xmax)

%persistent coef

%if(isempty(coef))
    coef = pi^2 / (12*psi0);
%end

for jx = 1:size(x,2)
    pdf(jx) = coef * exp(-coef*x(jx)) * theta4p(0,exp(-coef*x(jx)),x(jx));   
end

return

function [t4p] = theta4p(arg1, arg2, x)

sumtp = 0;
nn = max(100,min(10000,fix(5000/x)));                   % heuristic.
for jn = 1:nn
    nsq = jn^2;
    sumtp = sumtp + (-1)^(jn-1) * nsq * arg2^(nsq-1);
end

t4p = 2 * sumtp;

return

Contact us