Interpolation is a mathematical and statistical method used to estimate unknown values that fall between a set of known, discrete data points. It's essentially like connecting the dots.
Combinum supports linear interpolation in numeric dictionaries, which assumes a linear relationship between two adjacent data points to estimate values in between. The known value "x" is typically in the key column while the value to be calculated "y" is in a value column, but using a value column as the known value is also supported.
The interpolation is done using the formula below with the values x0, y0, x1 and y1 as the closest lower and higher values found in the dictionary.
Interpolation with the known value in the key column
When interpolating with the key column as the known value, Combinum finds the nearest lower and higher key and then calculates the value for the output column. This is done by using the InterpolateDict() method.
Examples
MovementAtTime |
|||
|---|---|---|---|
Key |
Distance |
Speed |
Acceleration |
0 |
0 |
0 |
1,2 |
1 |
0,57 |
1,11 |
1,02 |
2 |
2,16 |
2,04 |
0,84 |
3 |
4,59 |
2,79 |
0,66 |
4 |
7,68 |
3,36 |
0,48 |
5 |
11,25 |
3,75 |
0,3 |
InterpolateDict("MovementAtTime"; 2.3; "Distance")
Returns 2.889
InterpolateDict("MovementAtTime"; 2.3; "Speed")
Returns 2.265
Interpolation with the known value in a value column
When interpolating with a value column as the known value, Combinum finds the nearest lower and higher value in this column and then calculates the value for the output column. This is done by using the InterpolateDictByCol() method. If no output column is specified, the value of the key column is calculated.
Examples
InterpolateDictByCol("MovementAtTime"; "Distance", 2.9; "Speed")
Returns 2.268...
InterpolateDictByCol("MovementAtTime"; "Distance", 2.9; "Acceleration")
Returns 0.785...
Remarks
The method InterpolateDictByCol() does not check that the values of the driving column belong to adjacent keys, so if the searched value is "passed" in more than one place, unexpected results may occur.