How to plot a 3D cube or a horizontal slice from the following 3D data?
Show older comments
I have a 3D data (unable to attach here because of size limits) with dimension e.g., far_trc = 139 * 48 * 176.
139 are the number vertical layers
48 are the number of lines or verical traces
176 are the numbers of traces in each line (each of 48 lines have 176 traces).
How can I plot in matlab as a 3D cube just like below? and If I want take a small cube out from big cube how can I do it?

2 Comments
Handling voxels is tricky and there is specialised software or matlab toolboxes. There are a few file-exchange submissions that are very nice, but none can carve out a cube automatically.
As for just plotting though, without transparencies or slicing, if you have enough resolution (it sounds like you do, otherwise in case you could interpolate, but that's frown upon), you could just use scatter3
[xx, yy, zz] = meshgrid(1:100);
vv = cos(xx).*sin(yy).*abs(asin(zz)).^2;
scatter3(xx(:),yy(:),zz(:),5,vv(:));
colormap(jet);
colorbar;
You could remove the cube yourself, though it's not straightforward
vv(1:10,1:10,end-10:end) = nan;
scatter3(xx(:),yy(:),zz(:),5,vv(:));
colormap(jet);
Ahmed
on 2 Mar 2024
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




