How can I generate 3D matrix for different shapes?

1 回表示 (過去 30 日間)
Manu Francis
Manu Francis 2017 年 12 月 13 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by