Scipy光滑样条偏导数不起作用

xdyibdwo  于 2023-03-08  发布在  其他
关注(0)|答案(1)|浏览(124)

我尝试在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

当我试着求一阶导数时,也会给出同样的错误。我做错了什么?还是我的数据引起的?

t3irkdon

t3irkdon1#

集合ky=3解决了这个问题,似乎y的阶数也需要大于x的微分阶数。

相关问题