Linear Interpolation Between Known Values

Linear interpolation weights two endpoint values according to a position within their interval.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace one position
  2. Treat extrapolation separately
  3. Use a distance fraction to combine endpoint values
  4. Decide what to do outside the calibration interval

Trace one position

Between values 4 at x=2 and 10 at x=5, the point x=3 is one third along. The weighted result is \(4+(10-4)/3=6\). Time and position intervals identify the domain.

Treat extrapolation separately

Outside the sample interval the same formula extends a line and may be unsupported by the measurements. When to connect observations explains when an assumed intermediate value needs explanation.[1][2]

Use a distance fraction to combine endpoint values

Between samples \((2,9)\) and \((6,17)\), the point \(x=3\) is one quarter of the way across. The interpolated value is \(9+(17-9)/4=11\). The weights \(3/4\) and \(1/4\) sum to one. See weighted averages.

Interval [2,6], x=3
Fraction (3−2)/(6−2)=1/4
Weighted value (3/4)×9 + (1/4)×17 = 11

Decide what to do outside the calibration interval

Extending the same line beyond both samples is extrapolation and involves an additional assumption. Equal endpoint positions make the slope undefined. Test each endpoint and one outside input.

References

  1. Tobin A. Driscoll and Richard J. Braun, Fundamentals of Numerical Computation ↩
  2. Nicholas J. Higham, Accuracy and Stability of Numerical Algorithms ↩