How to define the bin size for a histogram
8 views (last 30 days)
Show older comments
Hello
I have 2 questions.
I am trying to create 100 bins for my histograms which covers actually 10000 data points. The command bincounts = histc(x,binranges), allows me to put the binranges value but I dont want to repeat (0 100 200..........10000)as the value for 'binranges'. So is there any shorter way to give that kind of argument for binranges to use that command. Once I know that, I can use bar(binranges,bincounts,'histc') to plot the histogram.
Second question, how do I normalize the area of the histogram to be 1.
Thanks
0 Comments
Accepted Answer
Guillaume
on 20 Sep 2014
There are two histogram functions in matlab. The other one, hist allows you to specify the number of bins instead of the edges.
As for normalising:
dist = hist(data, 100);
dist = dist / sum(dist);
5 Comments
More Answers (0)
See Also
Categories
Find more on Histograms 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!