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

trunvoda_pdf(x, theta, k, xt)
% trunvoda_pdf.m - evaluates a Truncated Voda Probability denisity.
%   See " Continuous Univariate Distributions", Johnson, Kotz and Balakrishnan,
%   J. Wiley, v.1, p.479, 1995. 
%
%   Created by  J. Huntley,  10/18/07.
%
%   Vector form of PDF!!!
%
%   Calls 'voda_pdf.m', 'voda_cdf.m'
%

function [pdf] = trunvoda_pdf(x, theta, k, xt)

%persistent coef

%Initializations.
%if(isempty(coef))
    nx = 1000;
    dx = xt / (nx-1);
    xtt = 0:dx:xt;
    c = voda_cdf(xtt,theta,k);
    coef = 1 - c(end);
%end

% Evaluate PDF.
pdf = voda_pdf(x,theta,k) ./ coef;

return


    

Contact us