Peak "coordinates of a histogram
Show older comments
Hi, I want to study the histogram of an array. This array has only one peak, I want to determine the bin related to the peak. I have just tried ksdensity() and then findpeaks() but if I want a good precision the hig number of points of ksdensity makes the process slow. Please could you tell me how to find out the bin related to the peak? A good hint could be to transform the histogram into a vector.
Accepted Answer
More Answers (1)
Steven Lord
on 10 Mar 2019
1 vote
Are you creating the histogram (the graphics object) or binning the data using histcounts?
In the former case. retrieve the BinCounts and BinEdges properties from the histcounts object. Use max to identify the maximum count and its location, and index into the edges vector to identify the edges of that bin.
In the latter case, do the same thing with the first two outputs of histcounts.
1 Comment
Damiano Capocci
on 12 Mar 2019
Categories
Find more on Data Distribution Plots 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!