What algorithm does the scattered interpolant 'boundary' extrapolation use when it extrapolates to a convex hull?
47 次查看(过去 30 天)
显示 更早的评论
The documentation within the 'boundary' extrapolation mode for the scattered interpolant states that it " [evaluates] to the value of the nearest point on the convex hull." However, if you have a non-convex domain smaller than its convex hull, then that specification seems to necessitate an initial extrapolation to approximate the function values on the convex hull that were external to the original domain. I would appreciate it if someone could provide the specific details of this algorithm for me or clarify the description if I have misunderstood something fundamental.
4 个评论
采纳的回答
William Rose
2025-9-20,2:12
I don't think you have misunderstood anything fundamental. The description is unclear. Here are examples to illustrate how it works. We will check each how extrapolation method "boundary" works with each of the three interpolation methods: "nearest", "linear", and "natural".
Example 1. Method=nearest, extrapolation method=boundary. In this case, it appears that the extrapolated value is the value of the nearest of the original points.
[X,Y]=meshgrid(0:4,0:3);
% Next: move corner point so data set is concave at corner
X(end)=3.3; Y(end)=2.3;
V=(X.^2+Y.^2).^0.5; % V=distance from origin
% Display X,Y points
figure; plot(X,Y,'ro','MarkerFaceColor','r')
Now examine the behavior around the top right corner of the plot above (x=3 to 5, y=2 to 4), since that is where the point set is concave.
[Xq,Yq]=meshgrid(3:.05:5,2:.05:4); % query points
% original points, near the query points (for plotting)
XL=X([15,16,19,20]); YL=Y([15,16,19,20]); VL=V([15,16,19,20]);
% Compute scattered interpolant, method=nearest, extrap.method=boundary
F1=scatteredInterpolant(X(:),Y(:),V(:),'nearest','boundary');
Vq1=F1(Xq,Yq); % interpolate and extrapolate
% Plot results
figure; surf(Xq,Yq,Vq1); colorbar; hold on; view(0,90)
plot3(XL,YL,VL,'ro','MarkerFaceColor','r')
xlabel('X'); ylabel('Y'); zlabel('Z'); title('nearest, boundary');
Careful examination of the points above suggests that the extrapolated value equals the value of the nearest original point, not the value of the nearest point on the boundary of the convex hull. For example, at Xq,Yq=4.05,3, extrapolated Vq1=4.47, which is the value of the closest original point (at X,Y=4,3). The closest point on the convex hull is at about X=3.525,Y=2.475, and this point has extrapolated value V=4.02 (by nearest neighbor). So, if Vq were using the extrapolated value at the closest point on the convex hull, Vq would be 4.02 when Xq,Yq=4.05,3. But Vq1 is not that.
Example 2: Method=linear, extrap.method=boundary.
% Compute scattered interpolant, method=linear, extrap.method=boundary
F2=scatteredInterpolant(X(:),Y(:),V(:),'linear','boundary');
Vq2=F2(Xq,Yq); % interpolate and extrapolate
% Plot results
figure; surf(Xq,Yq,Vq2); colorbar; hold on
plot3(XL,YL,VL,'ro','MarkerFaceColor','r')
xlabel('X'); ylabel('Y'); zlabel('Z'); title('linear, boundary');
Adjust the view to further appreciate and understand the plot.

In the case above, points along the convex hull boundary are intepolated linearly between the original points that are on the convex hull, ignoring original points interior to the convex hull. Points outside the convex hull are extrapolated from the convex hull boundary, and are not affected by points interior to the convex hull.
Example 3: Method=linear, extrap.method=boundary.
% Compute scattered interpolant, method=natural, extrap.method=boundary
F3=scatteredInterpolant(X(:),Y(:),V(:),'natural','boundary');
Vq3=F3(Xq,Yq); % interpolate and extrapolate
% Plot results
figure; surf(Xq,Yq,Vq3); colorbar; hold on
plot3(XL,YL,VL,'ro','MarkerFaceColor','r')
xlabel('X'); ylabel('Y'); zlabel('Z'); title('natural, boundary');
Adjust the view to understand the surface better. It looks the same as the plot when method='linear'.

This case is like the linear case: points on the convex hull boundary are intepolated linearly between the original points that are on the convex hull, ignoring original points interior to the convex hull. Points outside the convex hull are esitmated from the points on the convex hull boundary. Inside the convex hull, the esitmated values are slightly different with natural method than with the linear method, consistent with natural versus linear interpolation.
If you vary the height of the point inside the convex hull, you will see that the results with method="nearest" still work the same way. With method="linear" or "natural", the interpolated points on the convex hull boundary, and the extrapolated points outside the convex hull, are not altered by the adjustment of the nearby point inside the convex hull. Their height is determined only by the original and interpolated points along the boundary of the convex hull.
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Data Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!