The theory of "_mergesimpts" of builtin functions.

9 visualizzazioni (ultimi 30 giorni)
Suyee Bai
Suyee Bai il 30 Mar 2016
Risposto: Peng Liu il 22 Ago 2016
I'm trying to learn the theory of the function "griddata",and in the file "griddata.m",I found some codes like: xyv = builtin('_mergesimpts', [y, x, v], [myepsy, myepsx, Inf], 'average'); I cant find the source code or theory of "_mergesimpts",can u explain the theory of it please? Thanks a lot.:)

Risposte (2)

Walter Roberson
Walter Roberson il 30 Mar 2016
By context I can tell that it looks for points whose x is closer than myepsx and whose y is closer than myepsy, and that if it finds them then it replaces the pair with a single point whose value is the average of the values at the other two points.
I do not know how it handles "lines" of points, A close to B close to C but A not close to C.
  1 Commento
Suyee Bai
Suyee Bai il 30 Mar 2016
Modificato: Suyee Bai il 30 Mar 2016
The results of some tests of the function are as follows:
x = 1:0.001:10;
x = x.';
x0 = builtin('_mergesimpts',x,0.001,'first');
x1 = builtin('_mergesimpts',x,0.005,'first');
x2 = builtin('_mergesimpts',x,0.2,'first');
x3 = builtin('_mergesimpts',x,0.5,'first');
x4 = builtin('_mergesimpts',x,1,'first');
x5 = builtin('_mergesimpts',x,2,'first');
the data of x0,x1,x3,x4,x5 showed its regularity but the data of x2 doesnt. it's really hard to understand this phenomenon.

Accedi per commentare.


Peng Liu
Peng Liu il 22 Ago 2016
It is an undocumented built-in function, which finds unique elements/rows within a specified tolerance. You may find a detailed introduction about this functon: http://stackoverflow.com/questions/1988535/return-unique-element-with-a-tolerance
Matlab 2015a introduced a documented built-in function, uniquetol, to achieve a similar task.

Community Treasure Hunt

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

Start Hunting!

Translated by