how does griddata asses duplicates?

3 vues (au cours des 30 derniers jours)
Valeria Leto
Valeria Leto le 10 Fév 2022
Modifié(e) : Adam Danz le 11 Fév 2022
Hi! I would like to understand how griddata asses duplicate point. I opened the function and I found this section:
%Need x,y and z to be column vectors
sz = numel(x);
x = reshape(x,sz,1);
y = reshape(y,sz,1);
v = reshape(v,sz,1);
myepsx = eps(0.5 * (max(x) - min(x)))^(1/3);
myepsy = eps(0.5 * (max(y) - min(y)))^(1/3);
% look for x, y points that are indentical (within a tolerance)
% average out the values for these points
if isreal(v)
xyv = builtin('_mergesimpts', [y, x, v], [myepsy, myepsx, Inf], 'average');
x = xyv(:,2);
y = xyv(:,1);
v = xyv(:,3);
could somebody explain me
xyv = builtin('_mergesimpts', [y, x, v], [myepsy, myepsx, Inf], 'average');

Réponse acceptée

Adam Danz
Adam Danz le 10 Fév 2022
Modifié(e) : Adam Danz le 11 Fév 2022
That line calls Matlab's built-in static method or function matlab.internal.math.mergesimpts(). The comments describe what it's doing. It takes the x y v vectors and defines tolerance levels for each variable (myepsy, myepsx, Inf). The tolerance levels define which values are "identical" or "close enough to be identical". Identical values are then averaged to get rid of (near) duplicates.

Plus de réponses (0)

Catégories

En savoir plus sur Modeling dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by