我不能完全理解如何从点未排序的数据集中进行推断,即对于“x”来说是递减的。像这样:
http://www.pic-host.org/images/2014/07/21/0b5ad6a11266f549.png
我知道我需要分别为 x 和 y 值创建一个图。所以得到我这个的代码:(点是有序的)
x = bananax
y = bananay
t = np.arange(x.shape[0], dtype=float)
t /= t[-1]
nt = np.linspace(0, 1, 100)
x1 = scipy.interpolate.spline(t, x, nt)
y1 = scipy.interpolate.spline(t, y, nt)
plt.plot(nt, x1, label='data x')
plt.plot(nt, y1, label='data y')
现在我得到了插值样条线。我想我必须分别对 f(nt)=x1 和 f(nt)=y1 进行外推。我知道如何使用简单的线性回归从数据中进行插值,但我错过了如何从中推断出更复杂的样条(?)。目的是让外推函数遵循数据点的曲率。(至少在一端)
干杯,谢谢!