Skip to main content

interp1

Function interp1 

Source
pub fn interp1(
    x: &mut Array,
    y: Array,
    xq: Dynamic,
) -> Result<FLOAT, Box<EvalAltResult>>
Expand description

Given reference data, perform linear interpolation.

Both arrays must be sorted and have the same length.

Out-of-bound xq values are clamped to the minimum and maximum values of y respectively.

let x = [0, 1];
let y = [1, 2];
let xq = 0.5;
let yq = interp1(x, y, xq);
assert_eq(yq, 1.5);