Date: Feb 23, 2013 6:23 AM
Author: ganesh
Subject: Contour of a field in a non-rectangular (arbitrary) 2D domain

I have a set of data that looks likes the following:

!Sr.no. x-coord. y-coord potential at (x,y)
1 0.0000 1.0000 0.3508
2 0.7071 0.7071 2.0806
. .... .... ....
. .... .... ....
1000 0.0000 -1.0000 0.5688

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.

http://www.mathworks.com/matlabcentral/fileexchange/8998-surface-fitting-using-gridfit

But I could use this only when x and y values are monotonically increasing.

Has anyone encountered a problem like this before?
Thanks in advance for the help.