Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Linear interpolation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Linear interpolation between two known points== [[Image:Linear interpolation visualisation.svg|thumb|In this geometric visualisation, the value at the green circle multiplied by the horizontal distance between the red and blue circles is equal to the sum of the value at the red circle multiplied by the horizontal distance between the green and blue circles, and the value at the blue circle multiplied by the horizontal distance between the green and red circles.]] If the two known points are given by the coordinates <math>(x_0,y_0)</math> and {{nowrap|<math>(x_1,y_1)</math>,}} the '''linear interpolant''' is the straight line between these points. For a value <math>x</math> in the interval {{nowrap|<math>(x_0, x_1)</math>,}} the value <math>y</math> along the straight line is given from the equation of slopes <math display="block">\frac{y - y_0}{x - x_0} = \frac{y_1 - y_0}{x_1 - x_0},</math> which can be derived geometrically from the figure on the right. It is a special case of [[Polynomial interpolation#Constructing the interpolation polynomial|polynomial interpolation]] with {{nowrap|<math>n = 1</math>.}} Solving this equation for <math>y</math>, which is the unknown value at <math>x</math>, gives <math display="block">\begin{align} y &= y_0 + (x-x_0)\frac{y_1 - y_0}{x_1 - x_0} \\ &= \frac{y_0(x_1-x_0)}{x_1-x_0} + \frac{y_1(x - x_0)-y_0(x - x_0)}{x_1 - x_0}\\ &= \frac{y_1x - y_1x_0-y_0x + y_0x_0 + y_0x_1-y_0x_0}{x_1 - x_0} \\ &= \frac{y_0(x_1 - x)+y_1(x - x_0)}{x_1 - x_0}, \end{align} </math> which is the formula for linear interpolation in the interval {{nowrap|<math>(x_0,x_1)</math>.}} Outside this interval, the formula is identical to [[linear extrapolation]]. This formula can also be understood as a weighted average. The weights are inversely related to the distance from the end points to the unknown point; the closer point has more influence than the farther point. Thus, the weights are <math display="inline">1 - (x-x_0)/(x_1-x_0)</math> and <math display="inline">1 - (x_1-x)/(x_1-x_0)</math>, which are normalized distances between the unknown point and each of the end points. Because these sum to 1, <math display="block">\begin{align} y &= y_0 \left(1 - \frac{x - x_0}{x_1 - x_0}\right) + y_1 \left(1 - \frac{x_1 - x}{x_1 - x_0}\right) \\ &= y_0 \left(1 - \frac{x - x_0}{x_1 - x_0}\right) + y_1 \left(\frac{x - x_0}{x_1 - x_0}\right) \\ &= y_0 \left(\frac{x_1 - x}{x_1 - x_0}\right) + y_1 \left(\frac{x - x_0}{x_1 - x_0}\right) \end{align}</math> yielding the formula for linear interpolation given above.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)