Histogram
显示 更早的评论
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
采纳的回答
更多回答(1 个)
Walter Roberson
2011-9-13
0 个投票
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
类别
在 帮助中心 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!