comparison scripts/statistics/distributions/chi2pdf.m @ 5482:6bbfc37975d2

[project @ 2005-10-04 17:17:21 by jwe]
author jwe
date Tue, 04 Oct 2005 17:17:31 +0000
parents 56e066f5efc1
children 34f96dd5441b
comparison
equal deleted inserted replaced
5481:65e02518f4f5 5482:6bbfc37975d2
18 ## 02110-1301, USA. 18 ## 02110-1301, USA.
19 19
20 ## -*- texinfo -*- 20 ## -*- texinfo -*-
21 ## @deftypefn {Function File} {} chisquare_pdf (@var{x}, @var{n}) 21 ## @deftypefn {Function File} {} chisquare_pdf (@var{x}, @var{n})
22 ## For each element of @var{x}, compute the probability density function 22 ## For each element of @var{x}, compute the probability density function
23 ## (PDF) at @var{x} of the chisquare distribution with @var{k} degrees 23 ## (PDF) at @var{x} of the chisquare distribution with @var{n} degrees
24 ## of freedom. 24 ## of freedom.
25 ## @end deftypefn 25 ## @end deftypefn
26 26
27 ## Author: TT <Teresa.Twaroch@ci.tuwien.ac.at> 27 ## Author: TT <Teresa.Twaroch@ci.tuwien.ac.at>
28 ## Description: PDF of the chi-sqaure distribution 28 ## Description: PDF of the chi-square distribution
29 29
30 function pdf = chisquare_pdf (x, n) 30 function pdf = chi2pdf (x, n)
31 31
32 if (nargin != 2) 32 if (nargin != 2)
33 usage ("chisquare_pdf (x, n)"); 33 usage ("chi2pdf (x, n)");
34 endif 34 endif
35 35
36 if (!isscalar (n)) 36 if (!isscalar (n))
37 [retval, x, n] = common_size (x, n); 37 [retval, x, n] = common_size (x, n);
38 if (retval > 0) 38 if (retval > 0)
39 error ("chisquare_pdf: x and n must be of common size or scalar"); 39 error ("chi2pdf: x and n must be of common size or scalar");
40 endif 40 endif
41 endif 41 endif
42 42
43 pdf = gamma_pdf (x, n / 2, 1 / 2); 43 pdf = gampdf (x, n / 2, 1 / 2);
44 44
45 endfunction 45 endfunction