Fitting Curve to Data Points using Mathematica

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
Dustinsfl
Messages
2,217
Reaction score
5
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.
 
Physics news on Phys.org
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.