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

tsslope_cdf(x, alpha, theta, a, b)
% tsslope_cdf.m - evaluates a Two-Sided Slope Cumulative Distribution.
%   See "Dataplot Reference Manual", Vol.1, Aux., NIST, TSSPDF.
%
%   Vector Form of the CDF!!!
%
%  Created by Jim Huntley,  01/13/10
%

function [cdf] = tsslope_cdf(x, alpha, theta, a, b)

%persistent omth bma

%if(isempty(bma))
    omth = 1 - theta;
    bma = b - a;
%end

for jx = 1:size(x,2)
    arg = (x(jx) - a) / bma;
    if(arg > theta)
        cdf(jx) = 1 - (alpha*(1-arg) + (1-alpha)*(1-arg)^2/omth);
    elseif(arg <= theta)
        cdf(jx) = (alpha*arg + (1-alpha)*arg^2/theta);
    end
end        

return

Contact us