Skip to content

interpolate

Subhajit Sahu edited this page Dec 8, 2022 · 12 revisions

Estimate new values between existing ones.

Similar: interleave, intermix, interpolate, intersperse.


function interpolate(x, fc)
// x:  an array
// fc: combine function (a, b)
const xarray = require('extra-array');

var x = [1, 2, 3];
xarray.interpolate(x, (a, b) => (a + b)/2);
// → [ 1, 1.5, 2, 2.5, 3 ]
Clone this wiki locally