Data Interpolation Source Code

The data interpolation code provides a quick way to estimate values from tabular data using linear and logarithmic interpolation.

Source Code

Dependencies

There are no dependencies ouside of the C++ standard library.

Interpolation Mathematics

Given a set of data containing two one-dimensional vectors \mathbf{x} and \mathbf{y}, where the desired values y_i are known at discrete intervals as a function of the parameter x_i, the goal of interpolation is to determine any value of y from a chosen value for x, including value not occuring at the known intervals. For linear interpolation:

y = fy_{m+1} + (1 - f)y_m

f = \frac{x - x_m}{x_{m+1} - x_m}

Where the variables a and b denote the values above and below the desired point, respectively. Similarly, for logarithmic interpolation:

y = y_{m+1}^f + y_m^{1-f}

f = \frac{log(x) - log(x_m)}{log(x_{m+1}) - log(x_m)}


Please do not hesistate to submit any questions or comments you may have about the site by using the Contact page.