CSERD


  • userhome
  • catalog
  • resources
  • help

Interpolation Algorithm


Shodor > CSERD > Resources > Algorithms > Interpolation Algorithm

  


Interpolation

Interpolation refers to the process of estimating an intermediate value from two know values. You might assume that if you had a full tank of gas on Sunday, and a half tank of gas on the following Saturday, that if you drove more or less the same every day that you probably had about 3/4 of a tank on Wednesday.

This is clearly only an approximation, and as such, care must be taken when using interpolation.

Linear Interpolation

In general though, if you know values of $y(x_i)$ and $y(x_{i+1})$, the value of $y(x>x_i, x<x_{i+1})$ can be approximated by


\begin{displaymath}
y(x) = y(x_i) + \frac{y(x_{i+1})-y(x_i)}{x_{i+1}-x_i} x-x_i
\end{displaymath}

Higher Order Methods

The drawback to linear interpolation is that you assume the that function between two known points is a straight line. Some methods have been suggested that try to fit a polynomial or other known curve to data in order to get a slightly better approximation.

Due to the uncertainty inherent in any data, this is considered extremely risky unless you are absolutely sure that the functional form you are assuming is correct and that your data has a very high signal to noise ratio.

When in doubt, use linear interpolation.


©1994-2024 Shodor