Griddata - extrapolation beyond the Delaunay triangulation
64 ビュー (過去 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!