Accurately fitting curve to data

  • Thread starter komrane
  • Start date
Hi everyone,
I want to find a function to fit a two arrays data (X,Y=f(X)) with high precision, but I am not succeed.
Can any one help me.
These are my data:
X={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,
62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
91,92,93,94,95,96,97,98,99,100,101,102,103};
Y={-3.82047923,-4.78741509,-3.7235349,-3.83978508,-4.05577459,-4.30089612,-4.533835,
-4.74829898,-4.94488133,-5.12552735,-4.85195336,-4.7612524,-4.68355948,-4.69161082,
-4.73528276,-4.79596239,-4.86512986,-4.93839307,-4.76858464,-4.6914727,-4.75906268,
-4.83409367,-4.91083489,-5.06679286,-5.06287703,-5.13691706,-5.20911926,-5.27953551,
-5.41696518,-5.38100772,-5.41533957,-5.37176179,-5.37544389,-5.38749604,-5.40564269,
-5.42796115,-5.31359172,-5.24494792,-5.24966838,-5.26982538,-5.33876087,-5.36920739,
-5.40155805,-5.43522901,-5.47070746,-5.55225881,-5.54130792,-5.53404017,-5.50585981,
-5.49365225,-5.48926542,-5.4907033,-5.49650191,-5.50562495,-5.42179559,-5.36756524,
-5.36483956,-5.43302415,-5.46809702,-5.5035703,-5.53917246,-5.57474765,-5.61100546,
-5.61535429,-5.6811938,-5.71600271,-5.75053965,-5.78479005,-5.81874653,-5.85240181,
-5.8537986,-5.86366491,-5.87645036,-5.89129497,-5.90794966,-5.92512355,-5.94314335,
-5.98374099,-6.00311053,-6.00091604,-5.97752754,-5.96422759,-5.95638692,-5.9523968,
-5.95137799,-5.95274728,-5.89262269,-5.85051099,-5.83581257,-5.83046564,-5.86806419,
-5.88735021,-5.90739448,-5.95040446,-5.97217823,-5.97055505,-5.99290744,-6.03952233,
-6.06244391,-6.08579093,-6.10898718,-6.1322644,-6.12755437}.

Thanks a lot in advance
 
Be a little more precise...what is your exact definition of accuracy? I see that you have 103 data points, so you could come up with a 102nd degree polynomial that goes through every one of those points exactly using http://en.wikipedia.org/wiki/Polynomial_interpolation" [Broken]. All this would take is a bit of time for you to enter your data into a linear algebra program such as Matlab or Octave.

On the other hand, if you want the best linear approximation of that function you could consider http://en.wikipedia.org/wiki/Linear_least_squares" [Broken] or higher-order least squares approximations.

It all depends on your definition of "accurate" and what kind of curve you want to fit.
 
Last edited by a moderator:
695
2
Given that the X is simply a count, I presume this is a time series. It might be interesting to read/google about autoregression models or ARIMA models.
 
441
8
If you have access to a spreadsheet program such as excel, they contain functions for this purpose. You would have to try them to test for the degree of precision.
 

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving

Hot Threads

Top