Linear extrapolation with scatteredInterpolant
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I'm trying to linearly extrapolate a 2D interpolant made with scatteredInterpolant(). According to the documentation one can specify the extrapolation method in the function call, but I always get non-linear interpolation. Below an example, including the code to produce it. I'm trying to derive the zero level contour of the mound, but due to the non-linear extrapolation in some places the surface curves up and does not reach zero.
Is this a bug, or am I doing something wrong?
Thanks in advance, Maarten

X = [0.4980 0.4020 0.3050 0.2190 0.1180 0.2360 0.2390 0.2320 0.2280 0.2070 0.2730 0.1790 0.2320 0.1730 0.1790 0.1770]';
Y = [0.4270 0.4450 0.3970 0.3540 0.2820 0.6620 0.6220 0.5860 0.5260 0.3700 0.3560 0.3170 0.2160 0.1470 0.0790 0]';
Z = [0 0.1034 0.1521 0.1550 -0.0264 -0.0000 0.0303 0.0436 0.0254 0.1069 0.1063 0.0077 0.0884 -0.0093 -0.0050 0 ]';
sdi = scatteredInterpolant(X,Y,Z,'linear','linear')
xVec = linspace(min(X),max(X),50);
yVec = linspace(min(Y),max(Y),50);
[xMesh,yMesh]=meshgrid(xVec,yVec);
zMesh = sdi(xMesh,yMesh);
surf(xMesh,yMesh,zMesh);
hold on
plot3(X,Y,Z,'or','MarkerFaceColor','r')
xlabel X; ylabel Y; zlabel Z
0 comentarios
Respuestas (2)
John D'Errico
el 18 de Feb. de 2016
Linear interpolation is not extrapolation. In fact, it is actually a bit more difficult to extrapolate intelligently in multiple dimensions. Extrapolation in general is never a good thing, but extrapolation of a bumpy mess will give you highly unpredictable results.
Yes, you can use my gridfit tool (find it on the file exchange) to do this. I expect that you won't be terribly happy with the results if you try to extrapolate too far though.
0 comentarios
Maartencb
el 22 de Feb. de 2016
Editada: Maartencb
el 22 de Feb. de 2016
1 comentario
John D'Errico
el 22 de Feb. de 2016
Please don't add a answer when your goal is only to make a comment.
I have no idea why gridfit did not work for you. I think it did work, but you got an answer that you did not want. Since you did not completely explain your problem, I cannot help more.
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!