Crate interp

source ·
Expand description

A Rust implementation of Matlab’s interp1 function for linear interpolation.

Example

use interp::interp;

let x = vec![0.0, 0.2, 0.5, 0.8, 1.0];
let y = vec![0.0, 1.0, 3.0, 3.5, 4.0];

assert_eq!(interp(&x, &y, 0.35), 2.0);

Functions

  • Linearly interpolate the data points given by the x and y slices at point xp.
  • Linearly interpolate the data points given by the x and y slices at each of the points in the xp slice.