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

Home » Public Forums » archive » Yet another user with poly_fit problems
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Yet another user with poly_fit problems [message #86074] Mon, 30 September 2013 12:59 Go to previous message
Gus is currently offline  Gus
Messages: 7
Registered: September 2013
Junior Member
Hello everyone,

I've read a few of the older posts on this topic, but their solution didn't really help me solve the problem that I am currently having with the poly_fit function. The set of coefficients generated by the function (a 4th degree polynomial) produces some rather absurd results. Here is a short version of the problem I am having.

X = [0.000000, 11.6667, 822.914, 3458.85, 27703.4, 133928.]
Y = [15.9000, 16.0000, 17.0000, 18.0000, 19.0000, 20.0000]

C = poly_fit(X, Y, /double, yfit=D)

IDL generates the following coefficients (for C)

15.940691
0.0015355228
-3.0965110e-007
1.1170193e-011
-6.6767399e-017

Yet, one will clearly see that this fit produces rather undesirable results since, within the same range of X values (0 to roughly 150,000), this fit will produce Y values that can be as high as 1600 and as low as -3000 (rather than between 15.9 and 20). Excel is generating better coefficients than IDL!

Here is what I have already tried to do (and did not solve the problem)

1) Double precision of X and Y prior to using the poly_fit function (notice that I am using the "/double" keyword function already in that function);

2) Subtracting the mean of X from that array, before fitting the data - suggested in previous posts;

3) Subtracting the value of X[0] from that array, before fitting the data;

4) Subtracting the mean of Y from that array, before fitting the data.

Does anyone know of any other solution to this problem?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: cgContour and NaN values
Next Topic: reversing axes ranges with IDL 8 graphics

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

Current Time: Wed Oct 08 15:20:23 PDT 2025

Total time taken to generate the page: 0.00582 seconds