How does the Linear Extrapolation of ScatteredInterpolant() work?

3 views (last 30 days)
For my project I have to write a C++ code, equivalent to the ScatteredInterpolant() function of Matlab. My data points are scattered data in three dimension. I am able to calculate the Delaunay tetrahedrals using the TetGen library. I have compared the interpolation results using the tetrahedrals found from the TetGen and from the Matlab's own delaunay() function, the results are same as long as the query point is within the convex hull.
In my project, I have to extrapolate for the points outside the convex hull using linear extrapolation. I went through the Matlab documentation, and it says "Linear extrapolation based on boundary gradients." From my literature survey I could not find good documentation how the linear extrapolation work using the boundary gradients. I would really appreciate if you provide me insight how the linear extrapolation work for scatteredInterpolant().
I have looked into the scattered-data-extrapolation documentation page, which says " The 'linear' extrapolation method is based on a least-squares approximation of the gradient at the boundary of the convex hull. The values it returns for query points outside the convex hull are based on the values and gradients at the boundary." To verify, I have written the following code (2D data):
clc;clear;close all;
x = [ -1 1 1 -1 0 ]; y = [ -1 -1 1 1 0 ];
v = x.^2 + y.^2;
tri = delaunay(x, y);
F = scatteredInterpolant(x(:), y(:), v(:), 'linear', 'linear');
[xq, yq] = meshgrid( -2 : 0.1 : 2 );
vq = F(xq, yq);
figure; plot(x, y, 'r*');hold on; tri = delaunay(x, y); triplot(tri, x, y); xlabel('x');ylabel('y'); scatter3(x, y, v, 'r', 'filled');hold on; surf(xq, yq, vq); text(x(1), y(1), '1', 'fontsize', 20); text(x(2), y(2), '2', 'fontsize', 20); text(x(3), y(3), '3', 'fontsize', 20); text(x(4), y(4), '4', 'fontsize', 20); text(x(5), y(5), '5', 'fontsize', 20); box on; xlabel('x');ylabel('y'); set(gca, 'fontsize', 16);
Here is the X-Z view:
From my understanding the slope is 2, but why the extrapolated value is different? I may be missing something. I would really appreciate some insight.
Thank you
Mushfiq
06.02.2016
  1 Comment
Allen Olson
Allen Olson on 16 Aug 2018
I am also trying to understand this for the same reasons. A mathematical description would be very helpful.
Allen O.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!