How can I generate 3D matrix for different shapes?

2 visualizaciones (últimos 30 días)
Manu Francis
Manu Francis el 13 de Dic. de 2017
Hi,
I am trying to generate 3D matrices for different shapes as given in below figure like cylinders, cylinder with holes or donut shape etc.
I tried to generate cube with some inner cubes in 3D using following codes as below.
% numbers are arbitrary
cube=zeros(11,11,11);
cube(3:9,3:9,3:9)=5; % Create a cube inside the region
% Boring: faces of the cube are a different color.
cube(3:9,3:9,3)=2;
cube(3:9,3:9,9)=2;
cube(3:9,3,3:9)=2;
cube(3:9,9,3:9)=2;
cube(3,3:9,3:9)=2;
cube(9,3:9,3:9)=2;
vold3d('Cdata',cube,'alpha',cube/5)
and I got results as below
</matlabcentral/answers/uploaded_files/98386/shapes1.png> Even I could generate these shapes in cartesisan co-ordinate system. But I couldn't generate as matrix.
How can I generate 3D matrix for above mentioned shapes. This matrix can be 128x128x128 or512x512x512 size. Can anyone help

Respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by