Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Movies Up: Graphics Previous: 3D plots

Plotting experimental data

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 colour-coded 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.



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24