Clear Filters
Clear Filters

3D data plotting in matlab as a cube?

5 views (last 30 days)
Ahmed
Ahmed on 7 Mar 2024
Answered: Abhinaya Kennedy on 14 Jun 2024
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;

Answers (1)

Abhinaya Kennedy
Abhinaya Kennedy on 14 Jun 2024
"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.

Community Treasure Hunt

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

Start Hunting!