[SciPy-User] 2-D data interpolation

Andreas H. lists at hilboll.de
Thu May 31 09:27:33 EDT 2012


> 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-interpolation.

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.




More information about the SciPy-User mailing list