help-octave
[Top][All Lists]
Advanced

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

Paul Kienzle
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
-------------------------------------------------------------



reply via email to

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