Appendix C. Linear Interpolation

Linear interpolation is a way to approximate the value of a function at an arbitrary point based on a straight-line interpolation between two known points. The approach is shown graphically in Figure C.1. The graph demonstrates how to find the unknown value of YU at the given XG when two known points, (X0, Y0) and (X1, Y1), are given.

Figure C.1. A graphical description of linear interpolation

The calculation starts with the general equation for a straight line:

Y = m * X + b

The slope of the line, m, can be found using the following:

The Y-intercept of the line, b, can be found using either

b = Y0m * X0 or ...

Get Return on Software: Maximizing the Return on Your Software Investment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.