Go to the documentation of this file.
6 #ifndef MATHS_INTERPOLATION_LINEAR_H
7 #define MATHS_INTERPOLATION_LINEAR_H
11 namespace Interpolation
19 Linear(
int n,
double *x,
double *y) {
24 for (
int i = 0; i < n; ++i) {
40 while (x >
m_x[++i] && i <
size-1);
42 double a = (x -
m_x[i - 1]) / (
m_x[i] -
m_x[i - 1]);
43 return m_y[i - 1] + a * (
m_y[i] -
m_y[i - 1]);