Mercurial > hg > octave-lyh
comparison scripts/statistics/distributions/normcdf.m @ 5411:bee21f388110
[project @ 2005-07-13 17:53:44 by jwe]
author | jwe |
---|---|
date | Wed, 13 Jul 2005 17:53:49 +0000 |
parents | 56e066f5efc1 |
children | 34f96dd5441b |
comparison
equal
deleted
inserted
replaced
5410:56e066f5efc1 | 5411:bee21f388110 |
---|---|
16 ## along with Octave; see the file COPYING. If not, write to the Free | 16 ## along with Octave; see the file COPYING. If not, write to the Free |
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 ## 02110-1301, USA. | 18 ## 02110-1301, USA. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} normal_cdf (@var{x}, @var{m}, @var{v}) | 21 ## @deftypefn {Function File} {} normcdf (@var{x}, @var{m}, @var{v}) |
22 ## For each element of @var{x}, compute the cumulative distribution | 22 ## For each element of @var{x}, compute the cumulative distribution |
23 ## function (CDF) at @var{x} of the normal distribution with mean | 23 ## function (CDF) at @var{x} of the normal distribution with mean |
24 ## @var{m} and variance @var{v}. | 24 ## @var{m} and variance @var{v}. |
25 ## | 25 ## |
26 ## Default values are @var{m} = 0, @var{v} = 1. | 26 ## Default values are @var{m} = 0, @var{v} = 1. |
27 ## @end deftypefn | 27 ## @end deftypefn |
28 | 28 |
29 ## Author: TT <Teresa.Twaroch@ci.tuwien.ac.at> | 29 ## Author: TT <Teresa.Twaroch@ci.tuwien.ac.at> |
30 ## Description: CDF of the normal distribution | 30 ## Description: CDF of the normal distribution |
31 | 31 |
32 function cdf = normal_cdf (x, m, v) | 32 function cdf = normcdf (x, m, v) |
33 | 33 |
34 if (! ((nargin == 1) || (nargin == 3))) | 34 if (! ((nargin == 1) || (nargin == 3))) |
35 usage ("normal_cdf (x, m, v)"); | 35 usage ("normcdf (x, m, v)"); |
36 endif | 36 endif |
37 | 37 |
38 if (nargin == 1) | 38 if (nargin == 1) |
39 m = 0; | 39 m = 0; |
40 v = 1; | 40 v = 1; |
41 endif | 41 endif |
42 | 42 |
43 if (!isscalar (m) || !isscalar(v)) | 43 if (!isscalar (m) || !isscalar(v)) |
44 [retval, x, m, v] = common_size (x, m, v); | 44 [retval, x, m, v] = common_size (x, m, v); |
45 if (retval > 0) | 45 if (retval > 0) |
46 error ("normal_cdf: x, m and v must be of common size or scalar"); | 46 error ("normcdf: x, m and v must be of common size or scalar"); |
47 endif | 47 endif |
48 endif | 48 endif |
49 | 49 |
50 sz = size (x); | 50 sz = size (x); |
51 cdf = zeros (sz); | 51 cdf = zeros (sz); |