How to fit data to a function then have Mathematica mark the inflection points?

You can then use these coordinates to plot a point on your graph to indicate the inflection point. In summary, you can use the FindMaximum or FindMinimum functions to find the inflection points of your data and then plot them on your graph.
  • #1
rgrybra
2
0
Here's my data:

Code:
data = {{0.0, 2.91}, {0.25, 2.96}, {0.4, 3.08}, {0.7, 3.18}, {1.0, 
    3.25}, {1.2, 3.31}, {1.4, 3.37}, {1.6, 3.45}, {1.8, 3.49}, {2.0, 
    3.54}, {2.5, 3.65}, {3.0, 3.74}, {3.5, 3.81}, {4.0, 3.88}, {4.5, 
    3.94}, {5.0, 4.0}, {5.5, 4.04}, {6.0, 4.09}, {7.0, 4.19}, {8.0, 
    4.27}, {9.0, 4.35}, {10.0, 4.42}, {11.0, 4.50}, {12.0, 
    4.57}, {13.0, 4.64}, {14.0, 4.71}, {15.0, 4.79}, {16.0, 
    4.86}, {17.0, 4.94}, {18.0, 5.02}, {19.0, 5.12}, {20.0, 
    5.22}, {21.0, 5.34}, {22.0, 5.49}, {22.5, 5.56}, {23.0, 
    5.68}, {23.5, 5.80}, {24.0, 5.99}, {24.2, 6.09}, {24.4, 
    6.21}, {24.6, 6.38}, {24.8, 6.58}, {24.9, 6.79}, {25.0, 
    7.15}, {25.1, 8.83}, {25.2, 10.01}, {25.3, 10.23}, {25.4, 
    10.51}, {25.5, 10.68}, {25.6, 10.81}, {25.7, 10.89}, {25.8, 
    10.96}, {26.0, 11.08}, {26.2, 11.18}, {26.4, 11.25}, {26.6, 
    11.31}, {26.8, 11.37}, {27.0, 11.41}, {27.5, 11.52}, {28.0, 
    11.59}, {29.0, 11.71}, {30.0, 11.80}, {31.0, 11.87}, {32.0, 
    11.93}, {33.0, 11.97}, {34.0, 12.02}};

And here's my graph:

16bbvwm.png


Code:
ListPlot[data, AxesOrigin -> {0, 0}, PlotRange -> {0, 12.5}, 
 PlotStyle -> Directive[Red], 
 GridLines -> {Range[0, 34, .5], Range[0, 13, .25]}, 
 GridLinesStyle -> Directive[Thin, Dotted], Joined -> True, 
 Ticks -> {Range[0, 34, 2], Range[0, 13.0, 1]}, 
 InterpolationOrder -> 5, Mesh -> Full, 
 MeshStyle -> Directive[PointSize[Medium], Red], 
 Epilog -> {Directive[Dashed, Blue], 
   Line[{{12.0, 0}, {12.0, 4.57}, {0, 4.57}}], 
   Line[{{25.1, 0}, {25.1, 8.83}, {0, 8.83}}]}]

My inflection points are estimations, but I would like Mathematica to find them for me. How is this done?
 
Last edited:
Physics news on Phys.org
  • #2
</code>You can use the FindMaximum or FindMinimum functions to find the inflection points of your data. These functions will return the coordinates of the maximum or minimum values of a function. In your case, you can use the FindMaximum function to find the coordinates of the maximum value of the curve. The coordinates of the inflection point will be the x-coordinate of the maximum value and the y-coordinate of the corresponding data point.For example, to find the inflection point of your data, you can do the following:<code>FindMaximum[data[[All, 2]], {x, 0}](*{7.15, {x -&gt; 25.}}*)</code>This returns the coordinates of the maximum value (7.15) and the x-coordinate of the inflection point (25).
 

Related to How to fit data to a function then have Mathematica mark the inflection points?

1. How do I fit my data to a function in Mathematica?

To fit data to a function in Mathematica, you can use the "FindFit" function. This function takes in your data and a function form, and returns the best fit parameters for your data.

2. Can Mathematica automatically mark the inflection points on my data curve?

Yes, Mathematica has a built-in function called "FindRoot" that can be used to find the inflection points of a curve. You can then use the "Epilog" option in the "Plot" function to mark these points on your graph.

3. Do I need to have a specific type of data for Mathematica to fit it to a function?

No, Mathematica can fit data from any type of dataset, whether it is numerical, textual, or a combination of both. However, it is important to have accurate and sufficient data points for a good fit.

4. How do I know if the inflection points marked by Mathematica are accurate?

The accuracy of the inflection points marked by Mathematica depends on the accuracy of your data and the function you are fitting it to. It is always recommended to double-check the results and make sure they align with the expected behavior of your data.

5. Is there a way to visualize the fit of my data to the function in Mathematica?

Yes, you can use the "Show" function in Mathematica to plot both your data points and the fitted function on the same graph. This allows you to visually compare the fit and make any necessary adjustments.

Back
Top