From Ohm

Interpolation

The discrete representation requires the interpolation of function values $f(x_i)=y_i$ at the data grid points $x_i$.

Interpolation can be (from worst to best)

• linear
• cubic
• spline
• sinc

Linearily interpolated function f(x) between function values $y_1$ und $y_2$ of two data points $x_1$ und $x_2$ with interpolation weight (factor) $w\in[0..1], w=\frac{x-x_1}{x_2-x_1}$:

$f(x) = (1-w) \cdot y_1 + w \cdot y_2$

Cubically interpolated function:

$f(x) = ax^3 + bx^2 + cx + d$
$f(x_i) = y_i, i=0..3$

for $x_i = i-1$, the cubic coefficients a, b, c and d are:

$a = (y_3 - y_2) - (y_0 - y_1)$
$b = (y_0 - y_1) - a$
$c = y_2 - y_0$
$d = y_1$

faster evaluation of f(x):

$f(x) = d+(c+(b+ax)x)x$