Loading [MathJax]/jax/output/HTML-CSS/jax.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

5.2: Piecewise Linear Interpolation

( \newcommand{\kernel}{\mathrm{null}\,}\)

Instead of constructing a single global polynomial that goes through all the points, one can construct local polynomials that are then connected together. In the the section following this one, we will discuss how this may be done using cubic polynomials. Here, we discuss the simpler case of linear polynomials. This is the default interpolation typically used when plotting data.

Suppose the interpolating function is y=g(x), and as previously, there are n+1 points to interpolate. We construct the function g(x) out of n local linear polynomials. We write

g(x)=gi(x), for xixxi+1

where

gi(x)=ai(xxi)+bi

and i=0,1,,n1.

We now require y=gi(x) to pass through the endpoints (xi,yi) and (xi+1,yi+1). We have

yi=biyi+1=ai(xi+1xi)+bi.

Therefore, the coefficients of gi(x) are determined to be

ai=yi+1yixi+1xi,bi=yi

Although piecewise linear interpolation is widely used, particularly in plotting routines, it suffers from a discontinuity in the derivative at each point. This results in a function which may not look smooth if the points are too widely spaced. We next consider a more challenging algorithm that uses cubic polynomials.


This page titled 5.2: Piecewise Linear Interpolation is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Jeffrey R. Chasnov via source content that was edited to the style and standards of the LibreTexts platform.

Support Center

How can we help?