0
SciPy에서 보간 된 후 중간 점 배열을 얻으려고합니다. 그러나 그렇게하는 직접적인 방법이없는 것 같습니다. 누구든지 도와 줄 수 있습니까?SciPy CubicSpline의 중간 점 얻기
샘플 코드 :
from scipy.interpolate import CubicSpline
import matplotlib.pyplot as plt
x = np.arange(10)
y = np.sin(x)
cs = CubicSpline(x, y)
xs = np.arange(-0.5, 9.6, 0.1)
plt.figure(figsize=(6.5, 4))
plt.plot(x, y, 'o', label='data')
plt.plot(xs, np.sin(xs), label='true')
plt.plot(xs, cs(xs), label="S")
plt.plot(xs, cs(xs, 1), label="S'")
plt.plot(xs, cs(xs, 2), label="S''")
plt.plot(xs, cs(xs, 3), label="S'''")
plt.xlim(-0.5, 9.5)
plt.legend(loc='lower left', ncol=2)
plt.show()
중간 값에'cs '를 호출하려 했습니까? 예를 들어'new_xs = np.arange (-0.5, 9.6, 0.05)'를 사용하고'plt.plot (new_xs, cs (new_xs))'를 그릴 수 있습니까? –
죄송합니다,'xs'는 x보다 더 많은 포인트를 가지고 있습니다. 파생 상품은 큐빅 보간법을 사용하여 가지고있는 것보다 훨씬 더 세련 될 수 없습니다. 너 뭐하려고? –
감사합니다, –