Learning aid for clearer understanding

Compare interpolation methods visually

Adjust five support values and see immediately how nearest-neighbour, linear and shape-preserving cubic interpolation represent the same data sequence in different ways.

All calculations are performed locally in your browser.

Five values, three transparent outcomes

Use the sliders or drag the points vertically in the chart. The normalised values are intended solely for comparing the methods.

Direct comparison

You can also drag the marked support points directly up or down.

Comparison of three interpolation methods with possible realizations Five adjustable support points, three interpolation curves and possible layer paths.
  • Nearest neighbour
  • Linear
  • Shape-preserving cubic
  • Realizations

How the methods differ

Each method makes a different assumption about the progression between known support points.

Nearest neighbour

Every position is assigned the value of the closest support point. This creates constant sections with jumps halfway between two points.

Linear interpolation

Adjacent support points are joined by straight lines. The result is easy to follow, but has corners at the support points.

Shape-preserving cubic interpolation

PCHIP connects piecewise cubic polynomials and derives slopes from adjacent secants. Monotonic data sections remain monotonic, avoiding typical overshoot.