Possible Duplicate:
How do I make a surf plot in MATLAB with irregularly spaced data?
I have such data:
data = [
x1 y1 z1
x2 y2 z2
...
xn yn zn
];
I need to get surface of this data. Third row, z - will be the height of surface. But Xs and Ys are not monotonic continous data, so this doesn't work:
[X Y] = meshgrid(data(:,1), data(:,2));
Z = interp2(data(:,1), data(:,2), data(:,3), X, Y);
because my data in first and second row is not monotonic.
Update:
TriScatteredInterp can do this.(Thanks @Rody Oldenhuis)
F = TriScatteredInterp(data(:,1), data(:,2), data(:,3))
ti=1:10:600;
[qx qy] = meshgrid(ti, ti);
qz = F(qx, qy);
mesh(qx, qy, qz);