 MaplePortal/LinearInterpolation - Maple Help

 Linear Interpolation

Maple has multiple tools for interpolation, including linear, spline and more. Here we demonstrate how to linearly interpolate data.

 Experimental Data

This data was recorded during experiments on the outflow of a pump. The first column is time, while the second column is volumetric flowrate.

 > $\mathrm{flowData}≔\left[\begin{array}{cc}0.0& 0.2\\ 1.0& 2.0\\ 2.0& 3.5\\ 5.0& 6.0\\ 7.0& 9.0\\ 9.0& 8.0\\ 10.0& 8.0\\ 15.0& 10.0\\ 16.0& 11.0\\ 19.0& 12.0\end{array}\right]:$
 > $\mathrm{T}≔\mathrm{flowData}\left[..,1\right]:\phantom{\rule[-0.0ex]{0.0em}{0.0ex}}\mathrm{Q}≔\mathrm{flowData}\left[..,2\right]:$

 Create a Linear Interpolation Function

 >
 ${\mathrm{flowInterpolated}}{≔}{t}{↦}{\mathrm{CurveFitting}}{:-}{\mathrm{ArrayInterpolation}}{}\left({T}{,}{Q}{,}{t}\right)$ (1)

Hence at the time of 2.7, the interpolated flowrate is

 > $\mathrm{flowInterpolated}\left(2.7\right)$
 ${4.08333333333333}$ (2)

Plot the original experimental data against the linearly-interpolation values.

 > $\mathrm{f}≔\mathrm{plot}\left(\mathrm{flowInterpolated},\mathrm{min}\left(\mathrm{T}\right)..\mathrm{max}\left(\mathrm{T}\right)\right):$
 > $\mathrm{g}≔\mathrm{plot}\left(\mathrm{T},\mathrm{Q},\mathrm{style}=\mathrm{point},\mathrm{symbol}=\mathrm{solidcircle},\mathrm{symbolsize}=20\right):$
 > $\mathrm{plots}:-\mathrm{display}\left(\mathrm{f},\mathrm{g}\right)$ >