[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Polyfit with scaling
From: |
Thomas Weber |
Subject: |
Re: Polyfit with scaling |
Date: |
Thu, 31 Jan 2008 09:40:58 +0100 |
Am Mittwoch, den 30.01.2008, 17:48 -0600 schrieb Dmitri A. Sergatskov:
> On Jan 30, 2008 11:19 AM, Thomas Weber <address@hidden> wrote:
> > I'd like to propose the attached patch for polyfit.m
> > It introduces an optional fourth bool parameter 'scale'. If not set, or
> > if it's set to 'false', nothing changes.
> >
> > If it's set to true, the x values are scaled by their maximal absolute
> > value prior to calculating the polynomial coefficients. This has a
> > stabilizing effect on the calculation.
> >
>
> I do not understand why this change had not been made a long time ago
> -- we had few reports of faulty fits. I think the better
> scaling is:
>
> x = (x-mean(x))/std(x).
>
> wpolyfit from octave-forge does the scaling like that.
Tarball with a test directory attached. Output of the script in it:
norm difference with normal polyfit: 6.330024
norm difference with wpolyfit: 0.465359
norm difference with new polyfit: 0.082466
There are warnings from dgelsd, though. The data is taken from the unit
test, which in turn was taken from a bug report in Debian.
I don't use polynomial approximations often, so it would be nice if a
few people tested it with their data.
Thomas
polyfits.tar.gz
Description: application/compressed-tar