Interpolation Examples Visualized

Prev Next

Nearest Neighbor Interpolations

Assumption, applicable to all examples below: x[] = = {-2 .. -1.9 .. 12 }; // Creates sequence of -2, -1.9, -1.8, … 11.8, 12.

Example 1: nearest neighbor interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, flat );
Nearest Neighbor Interpolation
Example 2: nearest right neighbor interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, continue );
Nearest Right Neighbor Interpolation

Linear Interpolations

Example 1: linear interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, 0.1 ); // Using slope = 0.1
Linear Interpolation with specified slope
Example 2: linear interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, continue );
Linear Interpolation with same slopes outside

Spline Interpolations

Example 1: spline interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, zero );
Spline Interpolation with zero outside
Example 2: spline interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, continue );
Spline Interpolation with continuation outside

Polynomial Interpolations

Example 1: polynomial interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, flat );
Polynomial Interpolation with flat outside
Example 2: polynomial interpolation ( x[ ], { 1, 3, 4, 7 }, { 1, 3, 5, 2 }, continue );
Polynomial Interpolation with continuation outside