Welcome to our community

Be a part of something great, join today!

[SOLVED] Curve fitting

dwsmith

Well-known member
Feb 1, 2012
1,673
I am trying to use Mathematica to fit a curve to these data points
Code:
ListPlot[{{2*Pi/(1 - 0^2/16), 5 (3 - Log[2])}, {2*Pi/(1 - .05^2/16), 
   10 (3 - Log[2])}, {2*Pi/(1 - .1^2/16), 
   15 (3 - Log[2])}, {2*Pi/(1 - .15^2/16), 
   20 (3 - Log[2])}, {2*Pi/(1 - .2^2/16), 
   25 (3 - Log[2])}, {2*Pi/(1 - .25^2/16), 
   30 (3 - Log[2])}, {2*Pi/(1 - .3^2/16), 
   35 (3 - Log[2])}, {2*Pi/(1 - .35^2/16), 
   40 (3 - Log[2])}, {2*Pi/(1 - .4^2/16), 
   45 (3 - Log[2])}, {2*Pi/(1 - .45^2/16), 50 (3 - Log[2])},}, 
 PlotRange -> {{6.28, 6.39}, {10, 116}}]
However, I tried the Fit option and some other put it doesn't seem to work.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,193
I typically go with Excel as follows:

1. Put actual data in one column.

2. Use a few cells to write in the changeable arbitrary parameters of the function you want to fit.

3. Write the column next to the first one as having your theoretical curve, making sure to use $F$5 (for example), for the cells in step 2.

4. In the next column over, set cells equal to =(B2-A2)*(B2-A2).

5. Sum this last column.

6. Use the Solver routine to minimize the sum cell in step 5 subject to changing the parameters in step 2.

This is least-squares fit using any function you can write in Excel, which is quite a few.