[Top][All Lists]

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

polyfit weirdness

From: Scott Lamb
Subject: polyfit weirdness
Date: Tue, 11 Feb 2003 02:08:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020826

I'm trying to use Octave (2.1.36, 2.1.44) for the first time. I want to put some data in, make a trendline, and make a graph with the raw data, trendline, trendline's formula, and correlation displayed, and attach them to a LaTeX document when I'm done. (The sort of thing I could do easily in Excel, but I want to learn a new open-source tool.)

So first I'm calling polyfit to get the trendline:

    l1 = 1e-9 * [ 578.45 545.88 435.87 404.71 365.26 ]
    v1 =        [   0.66   0.79   1.40   1.58   1.92 ]
    f1 = 299792458 ./ l1
    [p1,cv1] = polyfit(f1,v1,1)

...and it doesn't return what I'd expect at all:

    p1 =


    cv1 =

      1.0260  1.0872  1.3616  1.4664  1.6248

cv1 should hold its computed (near-identical to v1) values, right? But they're not even close. Doing this in Excel gives a slope of 4.17e-15 and R^2 = .999. So these definitely aren't right. What am I doing incorrectly?

Scott Lamb

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]