Problem creating a histogram
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am trying to create a histogram where each bin is the length of the increments in another vector. Can anyone explain what I'm doing wrong with:
histc(screenhit,x)
where screenhit is the vector I want a histogram of, and x is simply a vector of numbers in increments of 0.01.
Thanks.
1 commentaire
Réponses (2)
Image Analyst
le 21 Nov 2012
Try this:
screenhit = randi(50, 1000, 1);
x = sort(50*rand(50,1)); % 50 random edges of bins
counts = histc(screenhit,x)
bar(counts, 'BarWidth', 1);
It certainly returns something!
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!