3D data plotting in matlab as a cube?

5 次查看(过去 30 天)
I am using following code fvc = isocaps(trc,1e-4); the problem is arises with 1e-4, for example, if my data ranges 0 - 1, if I select 1e-4 as zero it will not display the part data having zero values, how to solve it?
Following is my code and data size is 139 48 176.
fvc = isocaps(trc,1e-4); % meshgrid(1:sizes) by default, not like you care about coordinates
patch(fvc,'FaceColor','interp','EdgeColor','none') %interp
colormap(jet)
colorbar;

回答(1 个)

Abhinaya Kennedy
Abhinaya Kennedy 2024-6-14
"isocaps" treats the threshold (1e-4) as a strict cutoff. Values below the threshold are entirely excluded from the isosurface generation. Since your data ranges from 0 to 1, setting the threshold to 1e-4 removes all zero values from the output. You can try one of the following solutions.
1. Adjust the threshold:
Instead of using a fixed threshold, you can calculate a threshold based on a percentage of your data range. (https://www.mathworks.com/help/matlab/ref/prctile.html)
threshold = prctile(trc(:), 1); % Find the 1st percentile value
fvc = isocaps(trc, threshold);
2. Use a different isosurfacing function:
"isosurface" takes an additional argument specifying the desired isosurface value(s). You can set this value to 0 to include all data points, including zeros.

类别

Help CenterFile Exchange 中查找有关 Colorbar 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by