Griddata - extrapolation beyond the Delaunay triangulation
조회 수: 37 (최근 30일)
이전 댓글 표시
Hi all!
I have an array (for example):
A = [1114.74,419.09,139.578;
1102.49,442.43,139.188;
1081.19,433.00,138.894;
1094.47,414.38,139.072;
1070.44,408.88,138.810;
1068.03,369.45,138.715;
1080.25,392.28,138.941;
1085.77,374.79,139.178];
And wrote a code
[griNodN,griNodE] = meshgrid(min(A(:,1)):0.1:max(A(:,1)),min(A(:,2)):0.1:max(A(:,2)));
valGridDef = griddata(A(:,2),A(:,1),A(:,3)',griNodE,griNodN,'linear');
isolin=(min(A(:,3)):0.05:max(A(:,3)));
clim([min(isolin) max(isolin)]);
contourf(griNodE,griNodN,valGridDef,isolin);
colorbar
plot(A(:,2),A(:,1),'rs','MarkerSize',10,'LineWidth',3)
the result looks as expected
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1572577/image.jpeg)
In documentation is noted "For all interpolation methods other than 'v4', the output vq contains NaN values for query points outside the convex hull of the sample data. The 'v4' method performs the same calculation for all points regardless of location."
But v4 gives irrelevant result.
Is there another way to at least approximately extrapolate the surface beyond the Delaunay triangulation?
댓글 수: 0
채택된 답변
Mathieu NOE
2023년 12월 19일
hello
to have access to extrapolation , use scatteredInterpolant instead of griddata
A = [1114.74,419.09,139.578;
1102.49,442.43,139.188;
1081.19,433.00,138.894;
1094.47,414.38,139.072;
1070.44,408.88,138.810;
1068.03,369.45,138.715;
1080.25,392.28,138.941;
1085.77,374.79,139.178];
[griNodN,griNodE] = meshgrid(min(A(:,1)):0.1:max(A(:,1)),min(A(:,2)):0.1:max(A(:,2)));
F1 = scatteredInterpolant(A(:,2),A(:,1),A(:,3),'linear','linear');
valGridDef = F1(griNodE,griNodN);
isolin=(min(A(:,3)):0.05:max(A(:,3)));
contourf(griNodE,griNodN,valGridDef,isolin)
hold on
colorbar
plot3(A(:,2),A(:,1),A(:,3),'rs','MarkerSize',10,'LineWidth',3)
댓글 수: 2
추가 답변 (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!