[Math] Curve fitting to step function

graphing-functions

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

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$$

Related Question