I am stuck with this problem for the last two days and haven't found a solution so far. I have a data in the following format:
x1, y1, val1
.. .. ..
.. .. ..
xn, yn, valn
The values val1, ..., valn
are the field quantities I obtain after simulation on a geometry as below.
Only the grey region is the domain of interest whereas the one in blue/dark blue is not (including the inverted L shaped blue region in the interior). Thus the x and y coordinates of the data are scattered/irregular and with large gaps due to the hole in my original geometry. Is there a way to get a filled contour plot for this data? Trying the following in Matlab gives me triangulation with triangles outside the original polygon. Also, it fills the holes which is not what I want.
x = data(:,1);
y = data(:,2);
z = data(:,3);
%
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
xi = dt.Points(:,1) ;
yi = dt.Points(:,2) ;
F = scatteredInterpolant(x,y,z);
zI = F(xi,yi) ;
trisurf(tri,xi,yi,zI)
Another possibility was to import the data in ParaView and do filtering as Table-to-Points--> Delaunay Triangulation 2D
. But this has the same problems as Matlab. The holes are not analytical to mask the unwanted interpolated regions with NaN
s by using some mathematical expression.