python scipy.interpolate.splrep插值用法
from scipy.interpolate import splrep, splev X = [1, 9] Y = [20, 25] new_x = [1, 2, 3, 4, 5, 6, 7, 8, 9] # 进行三次样条拟合插值 ipo3 = splrep(X, Y, k=2) # 样本点导入,生成参数 iy3 = splev(new_x, ipo3) # 根据观测点和样条参数,生成插值 print(iy3)
输出结果
参考 :https://vimsky.com/examples/usage/python-scipy.interpolate.splrep.html