I am making some surface plots. I have 3 column vectors of data which are:
(X) which is a signal length
(Y) which is corresponding RPM values
(Z) which is corresponding Mass values
What I am then doing is:
xlin = linspace(min(X),max(X),30);
ylin = linspace(min(Y),max(Y),30);
[xx,yy] = meshgrid(xlin,ylin);
zz = griddata(X,Y,Z,xx,yy,'cubic');
figure(1)
clf
hold on
surf(xx,yy,zz)
Now this usually works fine. But with a particular set of X,Y,Z which to me don't seem to be any different to normal, the resulting surface plot looks a mess because the all the "points" are joined up.
What I mean is, the last point in a row is joined by diag line to the first point of the next row and the very last point at the top right corner is connected to the very first point in the bottom left.
Example (working correctly):
And incorrectly: