필터 지우기
필터 지우기

hist3 not returning expected output

조회 수: 1 (최근 30일)
z8080
z8080 2016년 8월 21일
I was trying to use hist3 to visually display a two-dimensional distribution, however the function behaves unexpectedly. I thought that it returns a 2D histogram (a count) of how many times each pair of numbers in the input matrix occurs, and displays that count at a position in the output matrix whose indices correspond to that number pair, scaled to a factor of 10 (by default) or some other square-matrix size. But this is not what my test examples showed.
If I define the following input matrix
1 1
2 2
3 3
4 4
5 5
then the command
v=hist3(m, [5 5])
has the following output (as expected):
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
However for this input matrix:
4 1
4 2
4 3
4 4
4 5
the output is:
0 0 0 0 0
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
0 0 0 0 0
..rather than (as I would have expected):
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 1 1 1 1
0 0 0 0 0
Can anyone help clear the confusion? THanks!

답변 (0개)

카테고리

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