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

perksym_pdf(x, a)
% perksym_pdf.m - evaluates a Perks Symmetrical Probability Density.
%   See "Generating NonUnifom Random Deviates", Chap. 9, L. Devroye.
%
%   Vector Form of PDF !!!
%
%  Created by Jim Huntley,  9/7/06
%

function [pdf] = perksym_pdf(x, a)

if(a == 2)
    %a = a + 1.0001;
    %c = real(1/(-i*pi+2*atanh(a/(-4+a^2)^(1/2)))*(-4+a^2)^(1/2));
    c = 1;
elseif(a < 2) 
    c = real(1/(i*pi+2*atanh(a/(-4+a^2)^(1/2)))*(-4+a^2)^(1/2)); 
elseif(a > 2)
    c = real(1/(-i*pi+2*atanh(a/(-4+a^2)^(1/2)))*(-4+a^2)^(1/2));
end

pdf = c ./ (a + exp(x) + exp(-x));    

return

Contact us