Search code examples
pythonmatlabscipyinterpolation

interp2(X, Y, Z, XI, YI) from Matlab to Python


I need the exact Python equivalent function of this Matlab function in order to interpolate matrices.

In Matlab I have:

interp2(X, Y, Z, XI, YI) 

while in Scipy I have:

interp2d(X, Y, Z). 

In Scipy XI and YI are missing. How can I resolve this? I'm using all parameters in Matlab.


Solution

  • The correct syntax is ip = interp2d(x, y, z); zi = ip(xi, yi).

    Also, interp2d is not exactly the same as interp2. RectBivariateSpline is closer.