18

我在文档或在线任何地方都找不到解释。“线性”代表什么,它有什么作用?

4

1 回答 1

17

查看 的来源scipy/interpolate/interpolate.pyslinear是1 阶样条曲线

if kind in ['zero', 'slinear', 'quadratic', 'cubic']:
    order = {'nearest': 0, 'zero': 0,'slinear': 1,
             'quadratic': 2, 'cubic': 3}[kind]
    kind = 'spline'

...

if kind in ('linear', 'nearest'):
    # Make a "view" of the y array that is rotated to the interpolation
    # axis.
    minval = 2
    if kind == 'linear':
        self._call = self._call_linear
    elif kind == 'nearest':
        self.x_bds = (x[1:] + x[:-1]) / 2.0
        self._call = self._call_nearest
else:
    minval = order + 1
    self._call = self._call_spline
    self._spline = splmake(x, y, order=order)

由于splmake状态的文档:

def splmake(xk, yk, order=3, kind='smoothest', conds=None):
    """
    Return a representation of a spline given data-points at internal knots
    ...
于 2013-07-10T14:30:56.177 回答