フィルターのクリア

How to get the number of samples of each bar in histogram?

3 ビュー (過去 30 日間)
Wenlong
Wenlong 2012 年 4 月 3 日
Dear all,
I have a mxn matrix where has n samples and each of them have m variables. I use hist(x, 20) to build histograms on each of the n samples.
Now I want to find how many variables that each bar in a histogram contains. What command should I used to achieve this automatically?
Thank you very much for your help.
Best wishes
Long

回答 (1 件)

Wayne King
Wayne King 2012 年 4 月 3 日
Use the output arguments
x = randn(1e3,1);
N = hist(x,20);
N gives you a vector of counts (frequencies) in each bin. If you want the bin centers as well.
[N,bincentr] = hist(x,20);

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by