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

hotel_cdf(x,n,rho)
% hotel_cdf.m - compute Hotelling r Cumulative Distribution Function.
%   See "Continuous Univariate Distributions", Johnson, Kotz, & Balakrishnan, 
%   J. Wiley, V. 2, p.549, 1995.              
%
%               Vector Form of CDF !!!
%
%  Created by:  Jim Huntley,  03/15/07.
%

function [cdf] = hotel_cdf(x,n,rho)

pdf = hotel_pdf(x,n,rho);

for jz = 1:size(x,2)
    if(jz == 1)
        cdf(jz) = trapz(pdf(1:jz));
    elseif(jz == 2)
        dx = x(2) - x(1);
        cdf(jz) = trapz(pdf(1:jz))* dx;
    elseif(jz > 2)
        dx = x(2) - x(1);
        cdf(jz) = simps(pdf(1:jz)) * dx;
    end
end

return



Contact us