Linear interpolation
lastmod 2022-03-22created 2022-03-223 edits
Linear interpolation is a method that, given the values at the endpoints, estimates a value lying between them by calculating linearly along the straight-line distance.
Linear interpolation between two points
Linear interpolation can be used to estimate the position of a point lying between two points.
For example, as in the figure on the right, given two endpoints \((x_{0},y_{0})\) and \((x_{1},y_{1})\), to estimate the value of \((x,y)\) lying between them, draw a straight line between the two points and set up the following proportion.
\({\displaystyle {\frac {y-y_{0}}{x-x_{0}}}={\frac {y_{1}-y_{0}}{x_{1}-x_{0}}}}\)
Solving this equation, the y value for a given value x can be found as follows.
\({\displaystyle y=y_{0}+(y_{1}-y_{0}){\frac {x-x_{0}}{x_{1}-x_{0}}}}\)