Back to Numerical Arrays (NumPy)
np.interp
One-dimensional linear interpolation for monotonically increasing sample points.
Syntax
np.interp(x, xp, fp, left?, right?)
Description
One-dimensional linear interpolation for monotonically increasing sample points. Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x.
Parameters
| Name | Description |
|---|---|
| x | - The x-coordinates at which to evaluate the interpolated values |
| xp | - The x-coordinates of the data points, must be increasing |
| fp | - The y-coordinates of the data points, same length as xp |
| left(optional) | - Value to return for x < xp[0], default is fp[0] |
| right(optional) | - Value to return for x > xp[-1], default is fp[-1] |
Returns
Promise<NDArray | number>