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

cdf4d(x, di, pv, distrib, cv)
function [f] = cdf4d(x, di, pv, distrib, cv)

lpv = length(pv);
dstring = char(strcat(distrib,'_cdf'));
h = str2func(dstring);

if(lpv == 0)
    if(cv(1) > 0)
        [f] = h(x, cv);
    else
        [f] = h(x);
    end
elseif(lpv == 1)
    a = pv(1);
    if(cv(1) > 0)
        [f] = h(x, a, cv);
    else
        [f] = h(x, a);
    end
elseif(lpv == 2)
    a = pv(1);
    b = pv(2);
    if(cv(1) > 0)
        [f] = h(x, a, b, cv);
    else
        [f] = h(x, a, b);
    end
elseif(lpv == 3)
    a = pv(1);
    b = pv(2);
    c = pv(3);
    if(cv(1) > 0)
        [f] = h(x, a, b, c, cv);
    else
        [f] = h(x, a, b, c);
    end
elseif(lpv == 4)
    a = pv(1);
    b = pv(2);
    c = pv(3);
    d = pv(4);
    if(cv(1) > 0)
        [f] = h(x, a, b, c, d, cv);
    else
        [f] = h(x, a, b, c, d);
    end
elseif(lpv == 5)
    a = pv(1);
    b = pv(2);
    c = pv(3);
    d = pv(4);
    e = pv(5);
    if(cv(1) > 0)
        [f] = h(x, a, b, c, d, e, cv);
    else
        [f] = h(x, a, b, c, d, e);
    end
else
    count = fprintf('\n\n Number of input arguments, %d, is > 5. \n\n', lpv);
end
return

Contact us