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

mandel_cdf(n, NN, q, s)
% mandel_cdf.m - evaluates a Zipf-Mandelbrot Cumulative Distribution.
%   See "http/en.wikipedia.org/wiki/ZipfMandelbrot_law", web.
%
%  Created by Jim Huntley,  07/15/05
%
%

function [cdf] = mandel_cdf(n, NN, q, s)

sum1 = 0;
for jn = 1:n
    sum1 = sum1 + 1 / (jn+q)^s;
end
Hn = sum1;
sum2 = 0;
for jNN = 1:NN
    sum2 = sum2 + 1 / (jNN+q)^s;
end
HNN = sum2;
cdf = Hn / HNN;

return

Contact us