我对 python 很陌生,使用 python2.7,并且有一些关于代码的问题:
import numpy as np
from scipy import interpolate
import pylab as py
x=np.r_[0:10:11j]
y=np.sin(x)
xnew=np.r_[0:10:100j]
#f=interpolate.interpld(x,y)
py.figure(1)
py.clf()
py.plot(x,y,'ro')
for kind in ['nearest','zero','slinear','quadtatic','cublic']:
f=interpolate.interpld(x,y,kind=kind)
ynew=f(xnew)
py.plot(xnew,ynew,label=kind)
py.legend(loc='lower right')
但它导致:
Traceback (most recent call last):
File "C:\Users\LCL\.xy\startups\python_web\my_first_try_on_python_web\python_Interpolation\example1.py", line 22, in <module>
f=interpolate.interpld(x,y,kind=kind)
AttributeError: 'module' object has no attribute 'interpld'