Fitting Curve to Data Points using Mathematica

Click For Summary
SUMMARY

This discussion focuses on fitting curves to data points using Mathematica and Excel. The user attempted to utilize the Fit function in Mathematica but encountered difficulties. They outlined a successful method in Excel for performing least-squares fitting, which involves setting up data columns, defining parameters, and using the Solver routine to minimize the error. The approach emphasizes the flexibility of Excel for custom functions in curve fitting.

PREREQUISITES
  • Familiarity with Mathematica 12.0 for curve fitting
  • Understanding of least-squares fitting techniques
  • Proficiency in using Excel for data analysis
  • Knowledge of defining and manipulating functions in Excel
NEXT STEPS
  • Explore Mathematica's Fit function and its parameters
  • Learn about advanced curve fitting techniques in Mathematica
  • Investigate Excel's Solver tool for optimization problems
  • Study least-squares fitting methods in statistical analysis
USEFUL FOR

This discussion is beneficial for data analysts, researchers, and anyone interested in curve fitting techniques using Mathematica and Excel for data modeling and analysis.

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.
 

Similar threads

Replies
5
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
5K