Creating a matrix from a 3D surf plot

3 views (last 30 days)
A
A on 2 Feb 2014
Is there a way to take 3 200x60 matrices that I plot as a surface and turn them into a single 3D matrix that I can then use slice on? I'm trying to take slices of a solid as it progress through space. I use surf on the three variables and it plots the first column of each variable then the second and so one resulting in a nice surface of the shape. Is there a way to then take that surface and turn it into a single matrix so I can then analyse interesting points? I read the help on 'slice', 'mesh' and and 'surf' and they imply I could do this.
Here is the code I'm using to plot the shape;
r = 1.0;
h = 2.0;
m = h/r;
[R,A] = meshgrid(linspace(0,r,60),linspace(0,2*pi,200));
X = R .* cos(A);
Y = R .* sin(A);
Z = m*R;
surf(X,Y,Z)
I thought I could create a volume matrix by doing this;
V=surf(X,Y,Z);
but then slice has issues as it doesn't create a m x n x p matrix but a single value.

Answers (0)

Community Treasure Hunt

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

Start Hunting!