|
Among the many interpolation techniques that are available, linear interpolation is one of the easiest to understand and implement, as the interpolating function is pieced together by a series of line segments connecting the breakpoints.
Suppose we have a finite set $S$ of ordered pairs $(x_1,y_1),\ldots,(x_n,y_n)$ of real numbers such that $x_1<x_2<\cdots <x_n$ . The linear interpolation function of $S$ is a real-valued function $f$ defined on $[x_1,x_n]$ such that, for $i=1,\ldots,n-1$ , $$f(x)=y_i + m_i (x-x_i),\quad\mbox{ where }m_i=\frac{y_{i+1}-y_i}{x_{i+1}-x_i}\mbox{ and }x\in [x_i,x_{i+1}].$$ In
other words, $f$ is a piecewise linear function such that $f$ is linear in each of the interval $[x_i,x_{i+1}]$ for $i=1,\ldots,n-1$ . When the points (in $S$ ) belong to the graph of a function $g$ defined on a subset of $[x_1,x_n]$ , we say that $f$ interpolates $g$ . We also say
that $f$ interpolates $S$ , as $S$ can be viewed as the graph of the function $g_S$ defined on $\lbrace x_1,\ldots, x_n\rbrace$ such that $g_S(x_i)=y_i$ .
Visually, the interpolation function can be constructed by line segments whose end points are pairs of points $(x_i,y_i)$ and $(x_{i+1},y_{i+1})$ for each $i=1,\ldots,n-1$ . The follow graph shows the linear interpolation function $f$ (in blue) of a set consisting of seven points (in dark green). Note that $f$ interpolates any function $g$ defined on a subset of $[x_1,x_n]$ such that $g(x_i)=y_i$ .
Example. Interpolate $\lbrace (4,7),(2,3),(6,1)\rbrace$ using linear interpolation.
Arrange the points so the $x$ -coordinates are in the ascending order. There are two line segments associated with these three points: $\ell_1$ with end points $(2,3),(4,7)$ and $\ell_2$ with end points $(4,7),(6,1)$ . Next, calculate the slopes with respect to each line segments: $$m_1=\frac{7-3}{4-2}=2\qquad\mbox{ and }\qquad m_2=\frac{1-7}{6-4}=-3.$$ Therefore, the linear interpolation function $f$ is given by
|