I have x,y,z data. I want to use TRISCATTEREDINTERP for various y such that y=y/100, y=y/10, y=y*10 etc. to interpolate on a specified grid.
I notice that the interpolated results are different. The following code demonstrates the behavior:
x = rand(10,1);y = rand(10,1);z = x.^2 + y.^2;for sFactor=[0.01 0.1 1 10 100]% Scale Y
y2 = y/sFactor;% Constrain the edges of the new triangulation so that they do not get swapped out
% This will violate the Delaunay criterion, but preserving the
% topology is more important in this usecase.
dtnew = DelaunayTri(x,y2);% Create the interpolants
F = TriScatteredInterp(dtnew,z);% Create the grid
xlin = linspace(min(x),max(x),300);ylin = linspace(min(y2),max(y2),300);[X,Y] = meshgrid(xlin,ylin);% Evaluate Z
Z= F(X,Y);% Visualization
figure;step_value = -(min(min(z)) - max(max(z)))/40;contour(X, Y, Z, 'Fill', 'on', 'LevelStep', step_value);colorbar('peer',gca, 'Fontsize', 18);end
Notice the variation/edges are not preserved in each case.
Best Answer