how does griddata asses duplicates?

2 visualizaciones (últimos 30 días)
Valeria Leto
Valeria Leto el 10 de Feb. de 2022
Editada: Adam Danz el 11 de Feb. de 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');

Respuesta aceptada

Adam Danz
Adam Danz el 10 de Feb. de 2022
Editada: Adam Danz el 11 de Feb. de 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.

Más respuestas (0)

Categorías

Más información sobre Modeling en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by