Griddata - extrapolation beyond the Delaunay triangulation

31 次查看(过去 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
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?

采纳的回答

Mathieu NOE
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Delaunay Triangulation 的更多信息

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by