0
votes

I want to fit this data to a trig function, as it is periodic. So far, this cubic model is my most accurate result.

Data = {{0, 4.042704626}, {1, 2.078666417}, {2, 1.174751826}, {3, 
    0.3352687769}, {4, 0.2094025098}, {5, 0.0614347256}, {6, 
    0.06293313355}, {7, 0.1011425361}, {8, 0.2648436037}, {9, 
    0.385090841}, {10, 0.9986888931}, {11, 1.678591497}, {12, 
    2.508709496}, {13, 2.891178123}, {14, 3.06799026}, {15, 
    4.494100019}, {16, 6.881438472}, {17, 8.603483798}, {18, 
    9.519011051}, {19, 10.42667166}, {20, 11.2448024}, {21, 
    11.1889867}, {22, 10.53343323}, {23, 7.246675407}};
model = a*x^3 + b*x^2 + c*x + d;
fit = NonlinearModelFit[Data, model, {a, b, c, d}, x]
Show[ListPlot[Data, PlotStyle -> Red], Plot[fit[x], {x, 0, 23}]]
1
You haven't asked a question.High Performance Mark

1 Answers

0
votes

A quintic model would be better.

model = a*x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f;
fit = NonlinearModelFit[Data, model, {a, b, c, d, e, f}, x]
Show[ListPlot[Data, PlotStyle -> Red], Plot[fit[x], {x, 0, 23}]]

enter image description here