我尝试在Scipy中对拟合的平滑样条曲线求二阶x导数,如下所示:
spline = SmoothBivariateSpline(x,y,z,kx=3,ky=1)
splinedxx = spline.partial_derivative(2,0)
这给予我以下错误:
File "C:\Users\xxxxx\AppData\Roaming\Python\Python39\site-packages\scipy\interpolate\_fitpack2.py", line 988, in partial_derivative
newc, ier = dfitpack.pardtc(tx, ty, c, kx, ky, dx, dy)
dfitpack.error: ((0 <= nuy) && (nux < ky)) failed for 7th argument nuy: pardtc:nuy=0
当我试着求一阶导数时,也会给出同样的错误。我做错了什么?还是我的数据引起的?
1条答案
按热度按时间t3irkdon1#
集合
ky=3
解决了这个问题,似乎y的阶数也需要大于x的微分阶数。