Function to fit a curve

350 Views Asked by At

I am trying to fit a function to data that looks like the following.

I have no idea what the function is, but by visual inspection it seems to be a parabola (or some other convex polynomial) + a scaled sinusoidal whose amplitude increases more than linearly.

I tried using a function finder from an online curve fitting tool at zunzun.com. All the functions reported by it ignore the sinusoidal component and look like a 'U'. I then tried to fit the following function but it does not result in a good fit.

 power((A*X-B),2) + C*sin(D+2*pi*X/E)*X + F

Please suggest candidate functions to fit this data. Also please suggest tools for curve fitting when the type of function is not known. Thanks for any hints. -neha enter image description here

2

There are 2 best solutions below

2
On BEST ANSWER

You can easily factor out the periodic part, it is robably something like $\sin(\frac{1}{40}x-K)\cdot L\exp(Mx)$. Find out $L$ and $M$ so it fits the amplitude increase (that is clearly exponential).

Once done, you will have a much simpler convex left, it's quite flat so it may be like a translation of $x^\alpha$ with $1<\alpha<2$.

1
On

Here's one possible function and the plot:

function: A polynomial to get a large 'U' + a sine whose amplitude increases as $x^4$ and a second harmonic added to the sine to make it skewed. This may not be the best solution, just one possible equation that fits reasonably well.

f(x)=P+Q*(x**3)+R*(x**2)+W*(x**4)+A*(x**5) + S*(sin(2*pi*x/(40)-T) - 0.45*sin(2*pi*x/(20)+pi/9))*(U*x**4) + V*(x**0.9) 

Curve-fitting has been done using gnuplot enter image description here