3d surfaces in matlab

1 view (last 30 days)
Cyrus
Cyrus on 31 Jul 2013
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.

Accepted Answer

Marc
Marc on 31 Jul 2013
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.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!