Mon 26 Dec 2011 07:36:18 AM UTC, original submission:
changeset 14104:614505385171
doc: Overhaul docstrings for polynomial functions.
has the side effect to broke a test inside polyfit.
isrow can not work as it is applied after y=y(:)
so this portion should be reversed
10.30
10.31 - y_is_row_vector = (rows (y) == 1);
10.32 -
10.33 ## Reshape x & y into column vectors.
10.34 l = numel (x);
10.35 x = x(:);
10.36 @@ -98,7 +97,7 @@
10.37 if (nargout > 1)
10.38 yf = v*p;
10.39
10.40 - if (y_is_row_vector)
10.41 + if (isrow (y))
10.42 s.yf = yf.';
10.43 else
10.44 s.yf = yf;
>>>>> processing /pub/hg/octave/scripts/polynomial/polyfit.m
***** test
x = 1000 + (-5:5);
xn = (x - mean (x)) / std (x);
pn = ones (1,5);
y = polyval (pn, xn);
[p, s, mu] = polyfit (x, y, numel(pn)-1);
[p2, s2] = polyfit (x, y, numel(pn)-1);
assert (p, pn, s.normr)
assert (s.yf, y, s.normr)
assert (mu, [mean(x), std(x)])
assert (s.normr/s2.normr < sqrt(eps))
!!!!! test failed
assert (s.yf,y,s.normr) expected
Columns 1 through 8:
3.50419 1.60995 0.84300 0.67356 0.77025 1.00000 1.42810 2.31817
Columns 9 through 11:
4.13221 7.53054 13.37184
but got
3.50419
1.60995
0.84300
0.67356
0.77025
1.00000
1.42810
2.31817
4.13221
7.53054
13.37184
Dimensions don't match
|