comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Speaking of curve fitting...
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Speaking of curve fitting... [message #58468 is a reply to message #58466] Thu, 31 January 2008 08:34 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
I guess this may have something to do with the finite precision
of your computer, which affects differently a polynomial
of 6th order evaluated at x=1000 than a polynomial of 6th
order evaluated at x=2E6 (as the ratio between the term
of different order in x is different in the two cases).

Whatever algorithm poly_fit use is likely to run into a problem
in the latter case, where the lower order terms are so small in
comparison with the high order terms. As the fit critically
depend in balancing out all the coefficients, this may well
lead to failure. It is not a good idea to use high order polynomial
on large numbers anyway...

Ciao,
Paolo

Lasse Clausen wrote:
> ... run the following code, spot the difference and explain, s'il vous
> plait.
>
> nn = 1000
> xx1 = dindgen(nn)
> xx2 = timegen(nn, start=julday(5,25,1980,11,23))
>
> yy1 = sin(2.*2.*!pi*xx1/(nn-1.))
>
> d = poly_fit(xx1, yy1, 6, yfit=yfit1, /double)
> d = poly_fit(xx2, yy1, 6, yfit=yfit2, /double)
>
> !p.multi = [0,1,2]
> plot, xx1, yy1, /xstyle
> oplot, xx1, yfit1, linestyle=1
> plot, xx2, yy1,/xstyle
> oplot, xx2, yfit2, linestyle=1
>
> end
>
> I had a quick look at POLY_FIT.PRO but I can spot nothing which could
> explain the above behaviour. I run 32bit IDL 6.4 on some Linux.
>
> Cheers
> Lasse Clausen
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Speaking of curve fitting...
Next Topic: REGRESS with intercept 0

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 21:33:16 PDT 2025

Total time taken to generate the page: 1.20085 seconds