2

The following curve shows an initial segment of smooth decline, followed by a set of nearly equal data points, followed by another smooth decline.

I am looking for a function that could best fit these data points.

Any suggestions?

an initial segment of smooth decline, followed by a set of nearly equal data points, followed by another smooth decline

L_R_T
  • 43
  • I guess you should adopt some piecewise approximation of some kind. Is a piecewise linear approximation too crude? If that is the case you could try a piecewise cubic spline. (Disclaimer: I am not an expert of those things.) – Giuseppe Negro Jan 09 '13 at 00:22
  • A polynomial function – Cactus BAMF Jan 09 '13 at 00:23
  • @CactusBAMF Yes, a polynomial of order 3 seems to work. I'll search for a method to fit a polynomial to those data points. – L_R_T Jan 09 '13 at 02:23
  • @GiuseppeNegro Thanks. I have used an Akima spline, which works very well, but I would prefer a function, rather than a piecewise approximation. – L_R_T Jan 09 '13 at 02:24
  • 1
    May I ask why? Strictly speaking, a piecewise approximation is a function---just one that takes a bit more effort to write down. What might the practical limitation be on using one? – Michael Grant Apr 09 '13 at 02:50
  • Scale ? Is this a wide strip of 1 unit $x$ or what? where is y-axis? – ABC Apr 09 '13 at 03:22

2 Answers2

1

A cubic polynomial $p(x)=ax^3+bx^3+cx+d$ would do a decent job here. The coefficients $a,b,c,d$ can be determined using linear least squares.

But you should also explore the possibility that your function contains a periodic component. These are not as easy to fit to the data when you don't know the period. But you can find the period either by eyeballing the residual of the polynomial approximation, or by taking the Fourier transform of the data. (I could not try this myself since no actual data is given in the question, only a plot).

1

This all depends. if you are simply looking for a function that best fits the points, I count $6$ critical points (places where the derivative changes sign), so you could fit with a polynomial of degree $7$. This means $8$ unknown coefficients without any other knowledge of the curve, but since it looks like you have more than $8$ points, you should be able to get some decent fit.

Then again, you can get a more accurate fit by assuming that the function is the sum of a linear component and a polynomial. The linear component is determined by the leftmost and rightmost points - no fit necessary. This should minimize the linear component of the fit polynomial and make the fit more robust.

Nevertheless, if the points derive from some physical measurement, then you need to ask yourself what model is best for the experiment - and how well does your model fit with the points? Further, you may want as low a dimension as possible because the points do look noisy (see my earlier comments about many critical points).

Ron Gordon
  • 138,521