Problem using TriScatteredInterp with highly constrained triangulations
9 次查看(过去 30 天)
显示 更早的评论
Hello,
I've been having a problem with TriScatteredInterp in version R2009a where I erratically obtain NaN values for my output value. I'm wondering if anyone else has had problems using constrained 2D Delaunay triangulations to create TriScatteredInterp objects, and if anyone has a suggested work-around.
To set up the problem a little, I have an scattered data set [X1,Y1] with point values V, which I need to interpolate into a different scattered data set [X2,Y2]. I also know the Delaunay triangulation of my data set, as calculated by MatLab when calling DelaunayTri, is not a very good triangulation for interpolating with, i.e. there are a lot of long, skinny triangles. Luckily, I know beforehand a better triangulation scheme, which I apply as a constraint into a Delaunay triangulation, which I then use as the triangulation for my interpolation object, like so:
% Data set [X1,Y1] with known values [V1], and known triangulation scheme [TRI]
trTri = TriRep(TRI,X1,Y1);
C = edges(trTri);
dTri = DelaunayTri(X1,Y1,C);
vInterp = TriScatteredInterp(dTri,V1,'linear');
V2 = vInterp(X2,Y2);
The points contained in the data set [X2,Y2] are all WITHIN the convex hull of the scattered data [X1,Y1]. However, I often will obtain NaN values in V2. Occasionally, all values in V2 are NaN. Also on occasion, if I try the interpolation a second time, i.e., I re-type the command: V2 = vInterp(X2,Y2), the interpolation will work fine: no NaN values at all. This is even the case if I interpolate each point one at a time through a FOR loop as such:
for n=1:length(X2)
V2(n) = vInterp(X2(n),Y2(n))
end
Ultimately, the performance of the interpolation object is extremely erratic. I initially chose to use TriScatteredInterp because it allowed me to constrain my interpolation object, and because I am interpolating FROM a scattered data set TO a scattered data set. I absolutely must constrain my triangulation, due to the DelaunayTri's non-ideal triangulation: the values returned by a TriScatteredInterp object created without the constraint C are complete garbage.
If anyone has any insight or potential work-around, I appreciate it in advance.
Cheers, Logan
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Delaunay Triangulation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!