Finding the required number of high frequency values from histogram
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
pratapaneni Chetan
le 22 Sep 2021
Modifié(e) : pratapaneni Chetan
le 23 Sep 2021
I have a 60032x1 matrix. With the data I have, I made a histogram. I want the three most repeating values from it. I want the bin centres so that i can plot another graph with it.
Can someone help me with this? Thanks in advance :)
0 commentaires
Réponse acceptée
Chunru
le 23 Sep 2021
a = [randn(10000,1)-5; randn(10000,1); randn(10000,1)+5];
histogram(a)
[y,edges] = histcounts(a);
% Use the center of edges as x-axis
x = (edges(1:end-1) + edges(2:end))/2; % bin centre
figure
plot(x, y)
[pks,locs] = findpeaks(y, x)
hold on
plot(locs, pks, '*')
1 commentaire
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!