Clear Filters
Clear Filters

How to get Bin Edges at specific Value point (Maximum value) in histogram.

8 views (last 30 days)
Hi,
I hava a simple query. I just want to know the BinEdges value at specific peak.
So, I am only intrested in the Peak value and its Bin edges values. How I can get this.
H=histogram(Data);
HMAX=max(H.Values,[],"all");
How to get Bin edges at max value point,ie., 164209.
Kindly advise.

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 28 Mar 2024
load('Data.mat')
H = histogram(DATA)
H =
Histogram with properties: Data: [640×9615 double] Values: [107571 0 0 0 0 113997 0 0 0 117632 0 0 0 0 0 122485 0 0 0 0 126756 0 0 0 0 129006 0 0 0 0 134149 0 0 0 133991 0 0 0 0 0 135543 0 0 0 0 164209 0 0 0 0 134254 0 … ] (1×165 double) NumBins: 165 BinEdges: [40.6000 40.6200 40.6400 40.6600 40.6800 40.7000 40.7200 40.7400 40.7600 40.7800 40.8000 40.8200 40.8400 40.8600 40.8800 40.9000 40.9200 40.9400 40.9600 40.9800 … ] (1×166 double) BinWidth: 0.0200 BinLimits: [40.6000 43.9000] Normalization: 'count' FaceColor: 'auto' EdgeColor: [0 0 0] Use GET to show all properties
%Get the index of the max value alongside
[HMAX, idx] = max(H.Values,[],"all")
HMAX = 164209
idx = 46
%USe the index to get the corresponding bin edges
H.BinEdges([idx idx+1])
ans = 1×2
41.5000 41.5200
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!