[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: polyfit() and Inf

From: Paul Kienzle
Subject: Re: polyfit() and Inf
Date: Sun, 30 Mar 2003 23:21:17 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212

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);

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

wpolyfit  in octave-forge returns  NaN:

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

Paul Kienzle

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]