histogram of a m-by-n matrix
Show older comments
I have a m-by-n matrix of values between 10^-20 and 10^-8 I drew it by
hist(My_mat(:),15);
I obtain only one big bin of the hist, instead I would like to get several of bins between min and max values. Is it correct my code above ? Do you have any suggestions?
Accepted Answer
More Answers (1)
Image Analyst
on 18 Jul 2014
You should have 15 bins, though some of them might be virtually empty and too short to notice on the display. So do this:
counts = hist(My_mat(:), 15);
bar(counts, 'BarWidth', 1);
message = sprintf('You have %d bins', length(counts));
uiwait(helpdlg(message));
What does this say? So, if you do in fact actually have 15 bins then you might have to scale the data if you want to see all of the bins, like the others suggested. You can either scale the data values, or the counts - whatever it takes to see your data better.
Categories
Find more on Histograms 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!