Linear interpolation is a method for constructing new data points between two existing data points in a linear fashion (analytically speaking using linear polynomials, geometrically speaking on a stright line between two points).
The formula for such an interpolation is
where a and b are the two points to interpolate between and u indicates the ratio along the line from a to b of the desired point. If u lies outside the range [0, 1] this is known as extrapolation.
It may be helpful to note the following:
This formula applies to points of any dimensionality.
For example, in R3:
A new point p at distance u would then be
Sometimes it is necessary to find both coordinates of a point on a line when only one coordinate is known (in addition to two points on the line). This can be accomplished by expanding the two-dimensional case. Given the desired x coordinate, we can find the corresponding y value:
Solving the first equation for u in terms of x:
and substituting into the second equation:
- TODO: Insert image to demonstrate usage.
|This article or section is incomplete and may require expansion and/or cleanup.
Please or discuss the issue on the talk page.
Linear interpolation has a few common applications. It is frequently used as a way to interpolate between values in a table. It can also be used as a way to animate an object moving between two points by using time as the ratio u.
- TODO: Discuss bilinear interpolation.