I need to generate a 2D contour for the above data where the value of the potential will be plotted at the corresponding (x,y) location on the 2D contour map. Now, this probably is straightforward if the domain is rectangular and the x-y grid for the contour command in Matlab is generated using monotonically increasing x and y values. My problem is that the domain of interest may not always be a rectangle and can have any arbitrary shape. So, the x-y grid can not be generated using the monotonically increasing x and y values. Also since the shape is arbitrary, there is no guarantee that I can always have a parametric representation of the domain.
Thus, the questions are:
1. Is there a way to generate a contour map of a field that is defined over an arbitrary shape in 2D.
2. If yes, then I will also need an efficient algorithm that interpolates the field over an arbitrary shape in order to generate a smooth contour. I am aware of a function (gridfit) by John D'Errico which is capable of doing this.