Finding the ranges where scatteredInterpolant is above threshold
8 ビュー (過去 30 日間)
表示 古いコメント
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
ThickRBInterpolant=scatteredInterpolant(thetaThickB,zThickB,ThickRB);
>> 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:
Thickness=ThickRBInterpolant(THETAC,ZC);
MarkerTHETA=THETAC;
MarkerZ=ZC;
MarkerTHETA(Thickness<a)=NaN;
MarkerZ(Thickness<a)=NaN;
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?
回答 (1 件)
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!