我曾经scipy
插入一些真实数据。我想在一些复杂的数据上评估拟合样条,有什么技巧可以强制scipy
执行吗?如果没有,是否有一些提供此功能的 python 包?
import scipy.interpolate as inter
spl = inter.InterpolatedUnivariateSpline( x, y )
当试图在复杂的情况下评估它时,会1.0j
出现一个铸造错误_fitpack._spl_
。
我曾经scipy
插入一些真实数据。我想在一些复杂的数据上评估拟合样条,有什么技巧可以强制scipy
执行吗?如果没有,是否有一些提供此功能的 python 包?
import scipy.interpolate as inter
spl = inter.InterpolatedUnivariateSpline( x, y )
当试图在复杂的情况下评估它时,会1.0j
出现一个铸造错误_fitpack._spl_
。
我有同样的问题,我想用一个复数来做这个。我的解决方案是独立地对实部和虚部进行样条:
spline_real = InterpolatedUnivariateSpline(t_in, in_.real)
spline_imag = InterpolatedUnivariateSpline(t_in, in_.imag)
out_real = spline_real(t_out)
out_imag = spline_imag(t_out)
然后再次组合成复数。
样条是在实线的特定间隔上单独定义的分段函数。将复数值插入样条曲线没有数学意义。这不是 SciPy 的限制;非实数参数的样条值是undefined。
如果你想拟合一个函数,然后在其中插入一个复杂的值,那么样条曲线是不适合这项工作的工具。您可以拟合为复杂参数定义的多项式或任何非分段模型。