
Department of Engineering 


Next: Movies
Up: Graphics
Previous: 3D plots
Most of matlab's 3D facilities expect the data to be evenly spaced on the
XY plane, but what if you have some scattered experimental data? First
you need to interpolate the data. Suppose you have your datapoints
in 3 arrays: x, y, and z. Then the
following will extrapolate the data onto a coarse 10 by 10 grid and
display a colourcoded surface.
xi=linspace(min(x), max(x), 10);
yi=linspace(min(y), max(y), 10);
[X, Y]=meshgrid(xi,yi);
Z=griddate(x,y,z,XI,YI)
surf(Z);
shading interp;
colorbar
There's also contour, scatter3, waterfall, slice and ezplot. The colormap command controls palettes. Type help graph3d for details.