help-octave
[Top][All Lists]

## Re: polyfit weirdness

 From: Miquel Cabanas Subject: Re: polyfit weirdness Date: Wed, 12 Feb 2003 13:57:23 +0100 User-agent: Mutt/1.3.28i

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

Also, what are eps, realmax and realmin in your versions? Again,
mines are,

eps =  2.2204e-16
realmax =  1.7977e+308
realmin =  2.2251e-308

Miquel

--
Miquel E Cabanas ------------------------------------------------------
SeRMN, Universitat Autonoma de Barcelona (address@hidden)
------------------------------------------o-oo--ooo---ooo--oo-o--------

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

```