Mercurial > hg > octave-nkf
changeset 4068:2c088a2f36e2
[project @ 2002-09-26 22:48:24 by jwe]
author | jwe |
---|---|
date | Thu, 26 Sep 2002 22:48:24 +0000 |
parents | e97fb79fc1d5 |
children | 593e213748b9 |
files | scripts/ChangeLog scripts/statistics/base/var.m |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2002-09-26 Jeff Cunningham <jeffrey@cunningham.net> + + * statistics/base/var.m: Handle complex values. + 2002-08-09 John W. Eaton <jwe@bevo.che.wisc.edu> * configure.in (AC_CONFIG_FILES): Add deprecated/Makefile to the
--- a/scripts/statistics/base/var.m +++ b/scripts/statistics/base/var.m @@ -40,9 +40,9 @@ y = 0; elseif ((nr == 1) || (nc == 1)) n = length (x); - y = (sumsq (x) - sum(x)^2 / n) / (n - 1); + y = (sumsq (x) - abs(sum(x))^2 / n) / (n - 1); else - y = (sumsq (x) - sum(x).^2 / nr) / (nr - 1); + y = (sumsq (x) - abs(sum(x)).^2 / nr) / (nr - 1); endif endfunction