counting total no of particles in a bin in histogram
5 次查看(过去 30 天)
显示 更早的评论
Hi, i have a basic problem. I had made a histogram with nbins = 100.
I want to count the number of particles of that which is maximum number of particles and display it.
what should be the best way to do it.
Thank you very much. Any help is highly appreciated.
3 个评论
采纳的回答
Saurabh Kelkar
2019-8-23
k = hist(x,n);
gives the counts in each of the bins.
modalBin = find(k==max(k) % Gets the bin number of highest bin. Will return two bins if clashes
Alternatively i would recommend using ecdf funtion for doing this.
5 个评论
Ted Shultz
2019-8-23
It looks like hist is discouraged by mathworks...
dpb
2019-8-23
Indeed, but there are some real advantages with them with respect to the new versions...the binning difference above being one and the ease in setting bins for certain specific uses. "Not everything new is necessarily improved."
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!