![](https://secure.gravatar.com/avatar/d593991505d6717eaf98a23379bcdeb9.jpg?s=120&d=mm&r=g)
Hi, I am converting a matlab code to python and I am looking for a function like interp2 [1] for 2-D data interpolation. My matlab code has calls like M = interp2(x,y,z, xi,yi, 'cubic') where x, y and z describe a surface function. The interp2 function returns a matrix M corresponding to the elements of xi and yi and determined by cubic interpolation. Any help would be greatly appreciated, [1] http://www.mathworks.com/help/techdoc/ref/interp2.html
![](https://secure.gravatar.com/avatar/a5172a0e32bf445abf49379c67206866.jpg?s=120&d=mm&r=g)
Hi,
I am converting a matlab code to python and I am looking for a function like interp2 [1] for 2-D data interpolation.
My matlab code has calls like
M = interp2(x,y,z, xi,yi, 'cubic')
where x, y and z describe a surface function. The interp2 function returns a matrix M corresponding to the elements of xi and yi and determined by cubic interpolation.
Any help would be greatly appreciated,
You have several choices in scipy.interpolate, see http://docs.scipy.org/doc/scipy/reference/interpolate.html#multivariate-inte.... Probably, you're looking for the two subclasses of BivariateSpline, namely LSQBivariateSpline and SmoothBivariateSpline, the first doind least-squares fitting, while the latter does some smoothing. Unfortunately, there's no examples in the docstrings as of now. Cheers, Andreas.
participants (2)
-
Andreas H.
-
Darcoux Christine