2
我有一條線應該被scipy.interpolate.splrep
和scipy.interpolate.splev
平滑。用Numpy/SciPy平滑線
line = ((x1, y1), (x2, y2), ... (xn, yn))
tck = interpolate.splrep(x, y)
我需要爲我的x座標找到更多值,它應該均勻排列。
newx = numpy.XXX(x)
newy = interpolate.splev(newx, tck)
例如, (1, 2, 4, 3) -> (1, 1.5, 2, 2.5, 3, 3.5, 4, 3.5, 3)
在Numpy/SciPy中有一個「簡單」的方法來實現這個嗎?
爲什麼你的x座標沒有排序? – 2011-05-31 18:18:43
我認爲這個關鍵問題是x系列沒有單調增加的時候? – talonmies 2011-05-31 18:19:05
是的你是對的,問題是x值注意一定會增加。我也可以將linspace應用於每一對座標......但我認爲會有某事。 「簡單」。 – 2011-05-31 18:21:29