[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: polyfit() and Inf
From: |
stefan |
Subject: |
Re: polyfit() and Inf |
Date: |
Sun, 6 Apr 2003 15:27:21 -0500 |
On Sun, 30 Mar 2003, Paul Kienzle wrote:
> stefan wrote:
>
> >I was experimenting with the polyfit() function. It works correct with
> >"normal" functions (y = f(x)). But it seems to compute ages (I never
> >waited until it finished) when there is a 'Inf' in the dataset.
> >
> > x = linspace(0,1,100);
> > y = x * 1 + 4;
> > y(99) = Inf;
> > [p,r] = polyfit(x,y,1);
> > disp(p);
> >
> >This piece of code works fine without the 'y(99) = Inf;' line and stucks
> >with it.
> >
> >I implemented the polyfit() function on my own. I get infinite results
> >but it does not stuck! Is this a real problem/bug with polyfit()? I
> >could send you my implemetation, if interested...
> >
>
> I get the same result (cygwin, octave-2.1.42). This is
> probably a bug in \, which relies on the functions in
> LAPACK.
>
> wpolyfit in octave-forge returns NaN:
>
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/octave/octave-forge/main/optim/wpolyfit.m?rev=HEAD&content-type=text/plain
>
> It uses the slower but more accurate QR decomposition:
>
> [Q,R,P] = qr(X,0);
> p = R\(Q'*y);
> p(P) = p;
>
> You can check it yourself against the NIST
> Statistical Reference Datasets
>
> http://www.itl.nist.gov/div898/strd/
My own implementation does just this! Thank you for verifying the
described (mis)behaviour.
Cheers,
address@hidden
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: polyfit() and Inf,
stefan <=