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

dblray_cdf(x, mu, sigma)
% dblray_cdf.m - evaluates a Double Rayleigh Cumulative Distribution.
%   See "Continuous Univariate Distributions", Johnson, Kotz and Balakrishnan,
%   Vol.1, J. Wiley, 1995, p.480.
%
%  Created by Jim Huntley,  10/10/08
%

function [cdf] = dblray_cdf(x, mu, sigma)

%persistent sigma2 coef

%if(isempty(coef))
    sigma2 = sigma^2;
    coef = 1 / (2*sigma2);
%end

if(x <= mu)
    cdf = coef * exp(-coef*(x-mu)^2)*sigma2;
elseif(x > mu)
    cdf = -coef * (exp(-coef*(x-mu)^2)-2)*sigma2;
end

return


Contact us