Plotting a 3-D Matrix, but only for some points

7 visualizaciones (últimos 30 días)
Mauricio Fortuna
Mauricio Fortuna el 22 de Nov. de 2019
Respondida: Bob Thompson el 22 de Nov. de 2019
I have 3 1 dimensional arrays representing XYZ coordinates. I also have a 3D array that corresponds to that, wherein each value is either 1 or 0. I'd like to create a 3-d surface plot where whenever its corresponding point in the matrix is one, it is plotted, whereas whenever it's 0 it is not (ie: if all values were 1 it would be a solid cube).
I have difficulty using normal means as each (X,Y) value has more than one z value corresponding to it.
Which function can I use to do this?
Thanks in advance,

Respuestas (1)

Bob Thompson
Bob Thompson el 22 de Nov. de 2019
I would suggest using scatter3 to make the actual plot. I would suggest using something like find to identify the locations of the 1 values. You may need your x, y, and z matrices if there is an offset, but the 3D matrix should give you the localized indices.
[r,c,s] = ind2sub(size(locationsmatrix),find(locationsmatrix == 1));
scatter3(r,c,s);

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by