필터 지우기
필터 지우기

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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by