Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
    
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 9 '13 at 0:22
    
A polynomial function –  Cactus BAMF Jan 9 '13 at 0: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. –  Laurent Jan 9 '13 at 2:23
    
@GiuseppeNegro Thanks. I have used an Akima spline, which works very well, but I would prefer a function, rather than a piecewise approximation. –  Laurent Jan 9 '13 at 2: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 9 '13 at 2:50
show 1 more comment

2 Answers 2

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).

share|improve this answer
add comment

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.