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

md1_pdf(n, rho)
% md1_pdf.m - evaluates an M/D/1 Queue-Size Probability Density.
%   See "Measures of the Potential for Load Sharing in Distributed
%   Computing Systems", M. G. Shriram and M. Singhal, IEEE Trans on
%   Software Engineering, Vol. 21, No. 5, May 1995.
%
%   Created by: J. Huntley, 10/24/06
%

function [pdf] = md1_pdf(n, rho)


omrho = 1 - rho;
exprho = exp(rho);

% Estimate and plot PDF.
pdf = omrho;
if(n > 0)
    pdf = omrho * (exprho - 1);
    if(n > 1)
        sum1 = 0;
        for jk = 1:n-1
            krho = jk*rho;
            logkrho = log(krho);
            nmk = n-jk;
            %sum1 = sum1 + (-1)^nmk * exp(krho) * ...
            %      (krho^nmk/exp(gammaln(nmk+1)) + krho^(nmk-1)/exp(gammaln(nmk)));
            sum1 = sum1 + (-1)^nmk * exp(krho) * (exp(nmk*logkrho - gammaln(nmk+1)) ...
                      + exp((nmk-1)*logkrho - gammaln(nmk)));
        end
        pdf = max(0,omrho*(exp(rho*n)+sum1));
    end
end

return;
    

Contact us