How to interpolate a function for two variable?

Hi Everyone,
I have function Z=f(X,Y). For each value of X and Y, I have Z.
(I dont have analytical expression for Z). I want to obtain more data-points, for this I am trying to use interpolation2d function in python. But, It requires a analytical expression for Z, which I dont have. Here, I provided the example:

X=[0.2, 0.4, 0.6, 0.8]
Y=[0.03, 0.06, 0.09, 0.12]
Z= [0.12, 0.3, 0.9, 0.16 ]

So far, I am trying in this direction:

import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
f = interpolate.interp2d(X, Y, Z, kind=’ quardetic’)

Further, How to plot Z against X and Y? (Through desnity plot? Actually I am new to python)

Thank you very much.
Any help will be appreciated.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.