简体   繁体   中英

3d array Matlab plot

I'm a little stuck plotting a 3D array in MATLAB. I have created some histograms that vary as I change a certain threshold. Meaning, for t=65, I have one histogram, for t=70, another and so on. I would like to make a 3D plot or surface where the third dimension is this threshold (t from 0-100 intervals of 5) and the other two dimensions are intensity and frequency respectively (as for the 2D histogram). How can I do that? I've looked at most of the plotting tools such as surf, isosurface, slices and so on. None of them seem to do the trick. My matrix is 80x100x20 where the 20 dimension is that of the threshold. Any ideas? THANKS!

Perhaps an example might help:

%# 20 intervals
t = linspace(0,100,20+1);
labels = strtrim(cellstr(num2str([t(1:end-1);t(2:end)]', '[%g,%g)\n')));  %#'

%# some sample data parametrized by t
x = randn(1000,20);
[count,bins] = hist(x, 10);

%# plot 3D bar graph
bar3(bins, count, 'histc')

xlabel('param intervals'), ylabel('bins'), zlabel('counts')
set(gca, 'XTick',1:2:20, 'XTickLabel',labels(1:2:end))
axis tight

屏幕截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM