Estimate a value between known data points using linear interpolation.
Linear interpolation estimates f(x) between two known points (x₀,y₀) and (x₁,y₁) by drawing a straight line between them: y = y₀ + (y₁-y₀)·(x-x₀)/(x₁-x₀). This is exact for linear functions and a first-order approximation for nonlinear ones.
Linear interpolation
y = y₀ + (y₁ - y₀) · (x - x₀) / (x₁ - x₀)
When the function is approximately linear between the two points, or when the points are close together. For curved data, use polynomial or spline interpolation.
The same formula works for x outside [x₀,x₁], but accuracy degrades quickly. Extrapolation should be used cautiously.