Mercurial > hg > octave-avbm
diff scripts/statistics/base/cov.m @ 8977:f464119ec165
further simplify some stats funcs
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 13 Mar 2009 21:26:13 +0100 |
parents | eb63fbe60fab |
children | f0c3d3fc4903 |
line wrap: on
line diff
--- a/scripts/statistics/base/cov.m +++ b/scripts/statistics/base/cov.m @@ -57,11 +57,11 @@ if (rows (y) != n) error ("cov: x and y must have the same number of observations"); endif - x = x - ones (n, 1) * sum (x) / n; - y = y - ones (n, 1) * sum (y) / n; + x = center (x, 1); + y = center (y, 1); c = conj (x' * y / (n - 1)); elseif (nargin == 1) - x = x - ones (n, 1) * sum (x) / n; + x = center (x, 1); c = conj (x' * x / (n - 1)); endif