Mercurial > hg > octave-nkf
comparison scripts/statistics/distributions/stdnormal_cdf.m @ 10523:e74bff13aa26
improve stdnormal_cdf accuracy by using erfc (bug #29543)
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 15 Apr 2010 21:10:07 +0200 |
parents | a1dbe9d80eee |
children | 1740012184f9 |
comparison
equal
deleted
inserted
replaced
10522:6538ff562949 | 10523:e74bff13aa26 |
---|---|
35 sz = size (x); | 35 sz = size (x); |
36 if (numel(x) == 0) | 36 if (numel(x) == 0) |
37 error ("stdnormal_cdf: x must not be empty"); | 37 error ("stdnormal_cdf: x must not be empty"); |
38 endif | 38 endif |
39 | 39 |
40 cdf = (ones (sz) + erf (x / sqrt (2))) / 2; | 40 cdf = erfc (x / (-sqrt(2))) / 2; |
41 | 41 |
42 endfunction | 42 endfunction |
43 | 43 |
44 | 44 |
45 | 45 |