Maximum occurrence value of histogram
Afficher commentaires plus anciens
I am working on R2019a how to find maximum occurrence value of a histogram.Please help. Thank you
Réponses (4)
Daniel Poiesz
le 11 Mar 2022
To find value most likely to occur:
[~, idx] = max(histogram.Values); % tallest bin(y value) and its index location
mostLikely = histogram.BinEdges(idx); % x value associated with greatest y value
KALYAN ACHARJYA
le 26 Juin 2019
Modifié(e) : KALYAN ACHARJYA
le 26 Juin 2019
Why you go for histogram? You can get the value from array itself
Maximum occurrence bins in histogram==Maximum occurrence element in data_array
data_array=[]
% This gives the value of repeated elemnets (Maximum occurrence)
data_mode=mode(y);
% Gives repetitions number
count1=sum(data_array(data_array(:)==data_mode))/data_mode
There may be more easier way.
1 commentaire
Balkar Singh
le 26 Juin 2019
Steven Lord
le 26 Juin 2019
0 votes
Call max (with two outputs, if you want both the highest bin count and the bin that has that count) on the Values or BinCounts properties of the histogram object, depending if you want to work with normalized or un-normalized data.
1 commentaire
Edward Li
le 23 Juil 2021
Can you explain how to call max with two outputs?
Daniel Gutierrez
le 18 Fév 2020
Modifié(e) : Daniel Gutierrez
le 18 Fév 2020
0 votes
If you try to get the value of the bin with the maximum repetitions in the histogram with a pdf function use:
max(histogram.Values)
1 commentaire
Balkar Singh
le 21 Fév 2020
Catégories
En savoir plus sur Histograms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!