MATLAB: Is the interpolant from TriScatteredInterp not smooth when the scattered data is smooth

fluctuatedfluctuationinterpolationMATLABnoise

I use TriScatteredInterp to interpolate my scattered data. I know that my data should lie on a smooth surface. However, the interpolated surface appears wrinkled and streaky.
For example, the following code generates this image of a smooth surface:
%%Create scattered points
x1Scale = 10;
x2Scale = 1000;
X = bsxfun(@times,rand(1000,2),[x1Scale x2Scale]);
%%Some smooth function for data values
V = sin(X*[1 0]' .* 1.5/x1Scale);
%%Interpolate and display
F = TriScatteredInterp(X,V);
x1 = 0.1:0.1:0.8 * x1Scale;
x2 = 0.1:0.1:0.8 * x2Scale;
[X1,X2] = meshgrid(x1,x2);
imagesc(x1,x2,F(X1,X2))

Best Answer

This is due to datapoints that are at different scales in the different dimensions.
TriScatteredInterp must first calculate a Delaunay triangulation of the scattered points to use as a datagrid. This is based, in part, on the proximity of the points.
A datagrid that with differently scaled dimensions may have neighbouring points that are different to what you may initially expect. Points that look close in one direction are in fact much farther apart than a point in another direction.
The workaround would be to scale your datapoints such that the dimensions are directly comparable. In the example above, you would set x2Scale = x1Scale.
Related Question