Show older comments
Hi, I am trying to make a histogram plot using 2 variables and the resulting frequency should be plotted as a bar graph. I tried using the bar function with the following sample code:
x=rand(10,1); y=rand(10,1); bar(x,y,'hist');
I wanted to bin the values in my x-axis. I don't have any idea on how to do it. Your suggestions will be most appreciated.
Thanks, Irene
Accepted Answer
More Answers (1)
Walter Roberson
on 13 Sep 2011
0 votes
If you have two variables, are you trying to produce a 3D bar chart such as is shown in the examples in bar3 ?
If you are wanting to histogram against both x and y, then you will want to use one of the MATLAB File Exchange contributions such as http://www.mathworks.com/matlabcentral/fileexchange/9896-2d-histogram-calculation
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!