Nearest Neighbour Interpolation vs Cubic Spline Interpolation.

As a part of Introduction to Numerical Methods1 various methods of interpolation are introduced and have to be implemented: Linear, Cubic (Quintic) Spline, Nearest Neighbour, Lagrange, which by the way is a good way to gain insight into their details. However, even if one has implemented them it is difficult to know their domain of application and which is superior than other, that is why I find it difficult to answer the following question:

Where using nearest neighbour interpolation is superior to cubic spline interpolation?

From what I've understood, the former interpolates by assigning the value of the nearest point which leads to a discretization in the result (interpolated data is consisted of intervals with the same values as the initial data, somehow extended),

while the latter is much more complex method that involves finding the coefficients of a set of $3^{rd}$ order polynomials defined on consecutive intervals determined by the data, by applying sets of constraints2 and solving the system of linear equations for the unknown coefficients, which are then used to evaluate a polynomial (interpolate) at specific point. In this way the result of the last method is "smoother" (difference from one point to another is small).

How do we define and measure how "good" is a method of interpolation and specifically how do we determine (in what circumstances?) which is better/superior between nearest neighbour and cubic spline?

1. Using MATLAB / Octave.

2. Mainly three groups of constraints: each polynomial must pass through the two points determining the interval of its definition; the first, second, etc derivatives of every two consecutive polynomials must be equal at each of their end points (smooth connections of the polynomials); derivative at global end points must be equal to some value (e.g. $0$)

3. Both Interpolations are performed on the same data.

• Apart from the quality of the interpolation sometimes feasibility is another problem. In most cases in the industry, you need to interpolate experimental data. And sometimes you have to do that on a microcontroller. There you are limited in both processor power and storage space. So maybe a cheap and fast method has to be sufficient, because of that restriction. – P. Siehr Sep 27 '17 at 13:16
• I forgot to mention, that you sometimes have to do that as quick as possible, e.g. in a controller for a motor. Then we measure "good" even more different. – P. Siehr Sep 27 '17 at 14:54

An example function would be if you used $4$ intermediate points (at $1,2,3,4$) to approximate the continuous (but not smooth) function $$y(x) = \left\{ \begin{array}{ll} 1 & 0<x<1 \\ x & 1<x<1.99 \\ 5.97-2x & 1.99<x<3.01 \\ x-3.06 & 3.01<x<4 \\ 4x -15.06 & 4<x<5 \end{array} \right.$$ If you were to use the nearest point interpolations you would obtain values which are considerably off but at least in the plausible range.