help-octave
[Top][All Lists]
Advanced

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

Re: polyfit weirdness


From: Paul Kienzle
Subject: Re: polyfit weirdness
Date: Wed, 12 Feb 2003 18:49:15 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212

Miquel Cabanas wrote:

hi,

On Tue, Feb 11, 2003 at 02:08:37AM -0600, Scott Lamb wrote:
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:

I think we can narrow the problem to be related to the
left-division in polyfit, could you try running (this is
what polyfit does),

  n = 1;
  l = 5;

  x = [ 5.1827e+14  5.4919e+14  6.8780e+14  7.4076e+14 ...
  8.2076e+14 ]';

  y = [ 0.66000  0.79000  1.40000  1.58000  1.92000 ]';

  X = (x * ones (1, n+1)) .^ (ones (l, 1) * (0 : n));
  p = X \ y;
  yf = X * p;

In my working Octave I get

  p =

     -1.4948e+00
      4.1680e-15
and (estimated y-values)

  yf =

    0.66529
    0.79416
    1.37188
    1.59262
    1.92605

Could this be a property of newer versions of LAPACK?



-------------------------------------------------------------
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]