Curve fitting to step function

2.3k Views Asked by At

If all that is known of a plot is that the curve passes through certain squares on a grid, is there any way, other than by estimation or trial & error, to work out what the equations to the curves may be?

Please see example below:

enter image description here

From the filled squares, I would like to work out the maximum curve, minimum curve, & the resultant step function.

(In the above example, the max & min curves are clearly $x^2$ & $(x-1)^2$. The blue curve enters the shaded squares on the LHS & the red curve exits the shaded squares on the RHS.)

2

There are 2 best solutions below

0
On BEST ANSWER

If the problem is to have a smooth "mean" curve, the equation is y(x)=(x-(1/2))²

If the problem is to have a stepped curve, the exact equation involves a Fourier series . An approximate is obtained with the the series limited to a number of terms depending on the expected accuracy.

$$y(x)=\left(x-\dfrac12+\dfrac1\pi\sum_{k=1}^\infty\dfrac1k\sin(2k\pi x)\right)^2$$

0
On

I'd suggest curve fitting the bottom corners and the top corners of the shaded cells. One easy way to experiment with curve fitting is to use Excel. You can chart the data and then use the "Add Trendline" function to do fitting with various types of curves.

Alternatively, fit a curve through the centers of the cells, and then create the min and max curves by translating the mid curve upwards and downwards by half the cell height.