change in polyfit()'s behaviour?
Ben Abbott
bpabbott at mac.com
Sat Jan 3 12:04:52 CST 2009
On Jan 3, 2009, at 11:47 AM, Thomas Weber wrote:
> Hi,
>
> the following raises in error in the 3.0 branch:
>
> polyfit ([1,2; 3,4], [1,2; 3,4],4)
> namely
> error: polyfit: x and y must be vectors of the same size
>
> In fact, this error is part of test_poly.m in the test/ subdirectory.
>
>
> In the development sources, the test has been removed and the output
> is
> now:
>
> octave:1> polyfit ([1,2; 3,4], [1,2; 3,4],4)
> ans =
>
> 0.011358 -0.113585 0.397547 0.432076 0.272603
>
> Is this change intentional, ie should polyfit handle matrices as input
> arguments?
>
> Thomas
It is compatible behavior, so it should accept matrices, provided they
are the same size.
>> polyfit ([1,2; 3,4], [1,2; 3,4],4)
Warning: Polynomial is not unique; degree >= number of data points.
> In polyfit at 72
ans = [0.02 -0.2 0.7 0 0.48]
It *may* be sensible to add the warning regarding the equations
exceeding the unknowns. However, QR calculates the minimum-norm which
I understand is unique. So I'm inclined to leave it as it is.
Ben
More information about the Octave-maintainers
mailing list