Finding the ranges where scatteredInterpolant is above threshold

8 ビュー (過去 30 日間)
Yi-xiao Liu
Yi-xiao Liu 2020 年 11 月 30 日
コメント済み: Yi-xiao Liu 2020 年 12 月 1 日
I have been using scatteredInterpolant to reconstruct surfaces from actual measured data points. To address the slight misplacement of the object among different measurements, a reference marker was placed on the object to enable correction. Ultimately it should look for multiple points but I would like to start from the maxima.
To put it mathmatically, for function f and f', I need to know (x1,y1) and (x2,y2) where f and f' reaches its maximum.
I have tried to create a fine enough grid but it appears to reach the resolution we need it exceed the memory limit just by creating the array
>> thetalinC=linspace(0,180,180000);
>> zlinC=linspace(0,20,20000);
>> [THETAC,ZC]=meshgrid(thetalinC,zlinC);
Error using repmat
Requested 20000x180000 (26.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may
take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
I know I can write a loop to reduce the range (and increase resolution) in steps, or just run it on a supercomputer, but am just wondering if there is already tools available?
Edit:Walter Roberson made a good comment on scatteredInterpolant not possible to exceed max sampled points, so I guess maxima is not the way to go. The question is thus changed to:
For a scatteredInterpolant f, find all (x,y) where f is larger than threshold a.
In theroy this is easy:
But this would still run into the same "out of memory" wall. I am confident that the area where Thickness>a is continuous, is there anyway to find the boundary w/o using too much RAM?
  2 件のコメント
Yi-xiao Liu
Yi-xiao Liu 2020 年 12 月 1 日
There should be only one such area


回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 12 月 1 日
scatteredInterpolant uses linear interpolation by default. The maximum possible value when you interpolate in the interior, is equal to the maximum input.
scatteredInterpolant uses linear extrapolation by default. If it is possible in your situation that the function as sampled is not uniformly surrounded by constant values smaller than the next closest interior points, then there could be an angle where the exterior points could be considered to have an upwards slope. In such a case, with linear interpolation, sampling sufficiently far away from the data boundary will give you indefinitely large values.
If you 100% confident that the maximum is somewhere on the interior, then do not bother to do the interpolation to find the maxima: just take the maxima of the input data.
Otherwise, if there is any possibility that the maxima might be along the outside, then do interpolation -- but you only need to do sampling along your outside boundary, not on the interior (the interior values cannot exceed the maxima of the input data.)
The logic behind all of this would be different if you were using a non-default interior interpolation, such as if you were using cubic spline.
If you do want to use cubic spline, then John D'Errico is much more qualified than I am to talk about possible optimization of finding maxima for cubic splines.
  3 件のコメント
Yi-xiao Liu
Yi-xiao Liu 2020 年 12 月 1 日
I am not sure I can follow you, bear with me as someone know nothing about triangulation.
Now what's next? I assume by original points you mean measured datapoints, so the part that are above threshold is then
But these are just points, and the neighbours function ask fot IDs as input. How do I find the triangles whose (at least one of) nodes are among those points? (BTW it seems neighbours accept both triangulation and delaunayTriangulation as input, what's the purpose of the 2nd step?)
(As far as I understand) what I now have is a pile of triangles that are above the threshold as well as those that the boundary runs through. That's nice though still not the actual boundary. I assume you could reduce the triangles to at least one node above threshold and at least one below (though I have no idea how to do it). After that have the triangles to intercept with plane Z=a and put all the intercepts together to get the boundary (still no idea how to do it)?
PS: I don't know if it would make the problem easier by asking for the center of the boundary (point where total distance to all boundary points is minimized).



Find more on Linear Algebra in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by