Gio*_*ioR 2 interpolation scipy python-2.7
我有一些分散的一维数据集,我想通过使用 scipy.interpolate.Rbf 函数用 rbf 函数进行插值。然而,对于一组特定的数据,插值似乎失败了,给出了 LinAlgError:singular matrix error。xy 数据为:
x = numpy.array([169., 161., 153., 146., 139., 134., 129., 127., 123.,
121., 119., 120., 119., 121., 124., 125., 128., 133.,
137., 141., 143.]])
y = numpy.array([415., 407., 398., 390., 380., 371., 361., 352., 342.,
333., 321., 313., 304., 296., 286., 277., 268., 259.,
250., 244., 239.])
rbf = interpolate.Rbf(x, y, function='cubic',smooth=0.)
Traceback (most recent call last):
File "<ipython-input-10-ddb099423b50>", line 1, in <module>
rbf = interpolate.Rbf(x, y, function='cubic',smooth=0.)
File "C:\WinPython-32bit-2.7.5.3\python-2.7.5\lib\site-packages\scipy\interpolate\rbf.py", line 207, in __init__
self.nodes = linalg.solve(self.A, self.di)
File "C:\WinPython-32bit-2.7.5.3\python-2.7.5\lib\site-packages\scipy\linalg\basic.py", line 100, in solve
raise LinAlgError("singular matrix")
LinAlgError: singular matrix
Run Code Online (Sandbox Code Playgroud)
我怎样才能避免这个错误?是不是因为我的数据点彼此非常接近并且 Gram 矩阵无法反转?我如何插入这些数据?
非常感谢。
| 归档时间: |
|
| 查看次数: |
2294 次 |
| 最近记录: |