Interpolate a 1-D function.
x and y are arrays of values used to approximate some function f: y = f(x). This class returns a function whose call method uses interpolation to find the value of new points.
Parameters : | x : (N,) array_like
y : (...,N,...) array_like
kind : str or int, optional
axis : int, optional
copy : bool, optional
bounds_error : bool, optional
fill_value : float, optional
|
---|
Examples
>>> from scipy import interpolate
>>> x = np.arange(0, 10)
>>> y = np.exp(-x/3.0)
>>> f = interpolate.interp1d(x, y)
>>> xnew = np.arange(0,9, 0.1)
>>> ynew = f(xnew) # use interpolation function returned by `interp1d`
>>> plt.plot(x, y, 'o', xnew, ynew, '-')
>>> plt.show()
Methods
__call__(x) | Evaluate the interpolant |