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

weibrice_pdf(x, c, A)
% weibrice_pdf.m - evaluates a Weibull Rice Probability Density.
%   See "Continuous Univariate Distributions", Johnson, Kotz, and Balakrishnan,
%   J. Wiley, v.1, p.693, 1995..
%
%  Created by Jim Huntley,  10/22/07
%
%   Calls 'simps.m'
%
%   Vector form of the PDF!!!
%

function [pdf] = weibrice_pdf(x, c, A)

%persistent Asq cd2 coef dphi phi

%if(isempty(coef))
    Asq = A^2;
    cd2 = 0.5 * c;
    coef = c * log(2) / (2*pi);
    nphi = 1000;
    dphi = 2 * pi / (nphi-1);
    phi = 0:dphi:2*pi;
%end

for jx = 1:size(x,2)
    poly = x(jx)^2 - 2.*A.*x(jx).*cos(phi) + Asq;
    kern = x(jx) .* exp(-log(2).*poly.^cd2) ./ poly.^(1-cd2);
    pdf(jx) = coef * simps(kern) * dphi;
end 

return

Contact us