What is the function that plots these curves?

107 Views Asked by At

I have a number of plots that appear as shaded squares on a grid:

enter image description here

The plots (apart from the rogue squares to the leftmost part of each plot) resemble $a\zeta(bx+c)-dx$, where $a$,$b$,$c$ & $d$ are constants (as shown on the left plot) but not exactly. I am looking for the function that generates each plot. Is there any way I can improve the fitting function, other than by trial & error?

2

There are 2 best solutions below

0
On BEST ANSWER

Solved, using Mathematica's FindFit option:

enter image description here

With:

data = {{2, 26}, {2, 25}, {2, 21}, {3, 22}, {3, 21}, {2, 22}, {3, 19}, {4, 20}, 
{4, 19}, {3, 20}, {4, 17}, {5, 18}, {4, 18}, {5, 17}, {6, 18}, {6, 17}, {6, 16}, 
{7, 17}, {7, 16}, {8, 17}, {8, 16}, {8, 15}, {9, 16}, {9, 15}, {10, 16}, 
{10, 15}, {11, 16}, {11, 15}}

model = a Zeta[b n + c]
fit = FindFit[data, model, {a, b, c}, n]
modelf = Function[{n}, Evaluate[model /. fit]]

Plot[modelf[x], {x, 0, 11}, Epilog -> Map[Point, data], PlotRange -> 
{{0, 11}, {0, 50}}, AspectRatio -> Automatic]

(Points where $x\leqslant1$ omitted to avoid problems with complex infinity.)

2
On

I'd recommend Excel as a good way to experiment with curve fitting. Use your point data to make a chart. Then right-click on the graph, and choose "Add Trendline". A dialog appears that lets you fit several different types of curves to your data.

By default, the displayed equation will show the coefficients accurate to 4 decimal places, which may not be good enough for you. If so, right-click on the displayed equation, and choose Format Trendline Label. A dialog appears that lets you change the number of decimal places displayed. Then you can copy/paste this equation to anyplace you want.

If you need the actual coefficients for further calculations, or if you want things like the R^2 and so forth, you can use the =LINEST() array function in Excel to get these. Google for details.