convert discrete function into continuous


There are infinitely many continuous functions that pass through your discrete points. And that is the problem. Which function do you want to use? This depends on what other properties you need the function to possess.

If continuity is your only criterion, then linear interpolation is the simplest. (Since you didn't say, I am going to assume you mean a function from $\Bbb R \to \Bbb R$, not higher dimensions.) If your points are $$\{(x_i, y_i) \mid 0\le i \le n, x_0 < x_1 < ... < x_n\}$$ Then you can define your function $f$ by: $$f(x) = \begin{cases}y_0 & x \le x_0\\\frac{y_1 - y_0}{x_1 - x_0}(x - x_0) + y_0 & x_0 < x < x_1\\\vdots\\\frac{y_n - y_{n-1}}{x_n - x_{n-1}}(x - x_{n-1}) + y_{n-1} & x_{n-1} < x \le x_n\\y_n & x_n < x\end{cases}$$ This gives a function with a saw-tooth shape, with vertices at each of your points.

If you want your function to be a polynomial, then you could find the Lagrange Polynomial. But be warned, this will often swing wildly back and forth between your points. So for example if $(0, 1)$ and $(1,2)$ are adjacent points in your data, it can occur that the value of the Lagrange polynomial at $1/2$ is on the order of 1,000, or even 1,000,000. If you want the heights of nearby points to be consistent, the Lagrange polynomial is not a good choice.

If you need your function to vary smoothly instead of having jagged corners like linearly interpolation, but also not swing wildly like the Lagrange polynomial, then cubic splines are your best bet.


Related videos on Youtube

Author by


Updated on October 29, 2020


  • Admin
    Admin about 3 years

    I have a function defined at discrete points which I need to convert into continuous so that I can get approximate values of function at points where it does not have value.Is there any function which can convert it into continuous.