MATLAB: 3d surfaces in matlab

surface 3d plotting

Hi everybody,
I'm relatively new to plotting 3d surfaces and am looking for help. I have some sets of data to work with (say, 3 columns), and was wondering if someone can show me a basic example of how to plot a 3d surface with a x,y,z axis.

Best Answer

doc surf doc mesh
k = 5;
n = 2^k-1;
[x,y,z] = sphere(n);
c = hadamard(2^k);
surf(x,y,z,c);
colormap([1 1 0; 0 1 1])
axis equal
figure;
[X,Y] = meshgrid(-8:.5:8);
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin(R)./R;
mesh(Z);
Straight from the documentation. You can also look for "GEOM3D" in the file exchange. This is a nice toolbox for creating 3d images. The code is there for you to dig into.