Effacer les filtres
Effacer les filtres

Griddata - extrapolation beyond the Delaunay triangulation

64 vues (au cours des 30 derniers jours)
Andrey Melnikov
Andrey Melnikov le 19 Déc 2023
Commenté : Mathieu NOE le 20 Déc 2023
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?

Réponse acceptée

Mathieu NOE
Mathieu NOE le 19 Déc 2023
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 commentaires
Andrey Melnikov
Andrey Melnikov le 19 Déc 2023
Great! Thanks a lot
Mathieu NOE
Mathieu NOE le 20 Déc 2023
my pleasure !
do you mind accepting my answer ? tx

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Delaunay Triangulation dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by