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

sz_pdf(x, n)
% sz_pdf.m - evaluates a Student's Z Product Probability Density.
%   See "Student's z-Distribution", http://mathworld.wolfram.com.
%
%  Vector Form of PDF.
%
%  Created by Jim Huntley,  11/04/05
%

function [pdf] = sz_pdf(x, n)

%persistent nd2 gamlnnd2 lrtpi gamln2

%if(isempty(nd2))
    nd2 = n/2;
    gamlnnd2 = gammaln(nd2);
    lrtpi = log(sqrt(pi));
    gamln2 = gammaln(nd2-0.5);
%end
    
pdf = exp(gamlnnd2 + log((1+x.^2).^(-nd2)) - (lrtpi + gamln2));

return

Contact us