Polyfit with scaling - Q regarding polyconf

Ben Abbott bpabbott at mac.com
Wed Feb 13 09:34:21 CST 2008


On Wednesday, February 13, 2008, at 08:31AM, "Thomas Weber" <thomas.weber.mail at gmail.com> wrote:
>Am Mittwoch, den 13.02.2008, 07:32 -0500 schrieb Ben Abbott:
>> Thomas, can you run the script below in Matlab and post the result?
>
>okay, v.m is the script you sent:
>
>=====================================================================
>>> version
>ans = 7.1.0.183 (R14) Service Pack 3
>>> v
>Warning: Polynomial is badly conditioned. Remove repeated data points
>         or try centering and scaling as described in HELP POLYFIT.
>> In polyfit at 79
>  In v at 6
>0.37235     0.19472      0.7227      0.2758      1.0236
>0.35854     0.17994     0.66785     0.26557     0.98568
>0.32231     0.13727      0.5095     0.23873     0.88608
>0.32448     0.14005     0.51979     0.24034     0.89203
>0.31328     0.12528       0.465     0.23205     0.86126
>0.32036     0.13475     0.50012     0.23729     0.88072
>0.31328     0.12528       0.465     0.23205     0.86126
>0.32448     0.14005     0.51979     0.24034     0.89203
>0.32231     0.13727      0.5095     0.23873     0.88608
>0.35854     0.17994     0.66785     0.26557     0.98568
>0.37235     0.19472      0.7227      0.2758      1.0236
>
>=====================================================================
>
>> The polyconf() I've written is attached.
>
>I'm confused. Should I run this with your polyconf as well?
>

Thanks Thomas!

No need run my script (feel free though).

I thought I had run the same in my earlier email, but after double checking, I'm no sure where those results came from. What I get is below.

0.37235    0.26288    0.19472    0.37235     0.2758
0.35854    0.24293    0.17994    0.35854    0.26557
0.32231    0.18533    0.13727    0.32231    0.23873
0.32448    0.18907    0.14005    0.32448    0.24034
0.31328    0.16914    0.12528    0.31328    0.23205
0.32036    0.18192    0.13475    0.32036    0.23729
0.31328    0.16914    0.12528    0.31328    0.23205
0.32448    0.18907    0.14005    0.32448    0.24034
0.32231    0.18533    0.13727    0.32231    0.23873
0.35854    0.24293    0.17994    0.35854    0.26557
0.37235    0.26288    0.19472    0.37235     0.2758

The only thing that appears to agree with Matlab is the result from polyval() ... which doesn't surprise me since I'm not clear on what polyconf() is supposed to be doing ... I had thought one of its four modes of operation would be equivalent to polyval().

If you (anyone?) has insight into how the algorithm for polyconf() should be written, feel free to pick apart the one I posted.

Meanwhile, it does appear that we now have a polyfit() and polyval() which respect the scaling, and whether or not a solution for fixing the polyconf(), I'll rewrite polyval() to work independently of it.

Ben


More information about the Octave-maintainers mailing list