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

triang_cdf(x, a, b, c)
% triang_cdf.m - evaluates a Cumulative Triangular Distribution.
%   See "Dataplot Reference Manual, TRICDF", 8-215, NIST, 3/21/97..
%
%  Created by Jim Huntley,  11/06/03
%

function [cdf] = triang_cdf(x, a, b, c)

if(x >= a & x <= c)
    cdf = (x-a)^2 / ((b-a)*(c-a));
elseif(x <= b & x > c)
    cdf = 1 - (b-x)^2 / ((b-a)*(b-c));
end

return

Contact us