interp2MATLABの関数と同等のPythonが必要です。このMATLABの例をPythonで動作させようとしていますが、できません。
import numpy as np
from scipy.interpolate import interp2d
from scipy.interpolate import RectBivariateSpline
service = np.array(range(10, 31, 10))
years = np.array(range(1950, 1991, 10))
wage = np.array([[150.6970,199.5920,187.6250],
[179.3230, 195.0720, 250.2870],
[203.2120, 179.0920, 322.7670],
[226.5050, 153.7060, 426.7300],
[249.6330, 120.2810, 598.2430]])
ip = RectBivariateSpline(years, service, wage)
print(ip(15, 1975))
しかし、私は解決できないこのエラー(RectBivariateSplineで)を受け取ります:
Traceback (most recent call last):
File "/Users/andrea/Documents/workspace/PythonProjects/pyArmBot/src/foo.py", line 15, in <module>
ip = RectBivariateSpline(years, service, wage)
File "/Library/Python/2.7/site-packages/scipy-0.10.1-py2.7-macosx-10.7-intel.egg/scipy/interpolate/fitpack2.py", line 728, in __init__
kx,ky,s)