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

wcauchy_cdf(x, p, mu)
% wcauchy_cdf.m - evaluates a Cumulative Wrapped-Cauchy Distribution.
%   See "Dataplot Reference Manual, WCACDF", Aux-370, NIST, 3/26/97.
%
%  Created by Jim Huntley,  8/25/04
%

function [cdf] = wcauchy_cdf(x, p, mu)

twopi = 2*pi;
if(x >= mu & x < pi+mu)
    cdf = (atan((-sin((x-mu)/2)-p*sin((x-mu)/2)) / (-cos((x-mu)/2)+p*cos((x-mu)/2))) - ...
        atan((sin((x-mu)/2)+p*sin((x-mu)/2)) / (-cos((x-mu)/2)+p*cos((x-mu)/2)))) / twopi;
elseif(x>=pi+mu & x <= (2*pi+mu))
    cdf = 1 - (atan((-sin((twopi-x+mu)/2)-p*sin((twopi-x+mu)/2)) / (-cos((twopi-x+mu)/2)+p*cos((twopi-x+mu)/2))) - ...
        atan((sin((twopi-x+mu)/2)+p*sin((twopi-x+mu)/2)) / (-cos((twopi-x+mu)/2)+p*cos((twopi-x+mu)/2)))) / twopi;    
end

return

Contact us