how does griddata asses duplicates?

3 visualizzazioni (ultimi 30 giorni)
Valeria Leto
Valeria Leto il 10 Feb 2022
Modificato: Adam Danz il 11 Feb 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');

Risposta accettata

Adam Danz
Adam Danz il 10 Feb 2022
Modificato: Adam Danz il 11 Feb 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.

Più risposte (0)

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by