How to set the Bin width of the histogram ?
조회 수: 283 (최근 30일)
이전 댓글 표시
I am setting the bin width to 0.05 as can be in seen in the code snipet below
h1 = histogram(Data);
h1.Normalization = 'probability';
h1.BinWidth = 0.05;
But the histogram does not set the bin width to 0.05. It varies every time I run the function.
Please help.
댓글 수: 1
the cyclist
2019년 6월 13일
This code set the bin width to 0.05 for me, as expected.
Data = rand(100,1);
h1 = histogram(Data);
h1.Normalization = 'probability';
h1.BinWidth = 0.05;
Can you upload an example of the variable Data that exhibits the problem?
답변 (2개)
Paramjit Yadav
2021년 7월 8일
How to set the bin width and bin edges simulataneously. Please help.
댓글 수: 2
the cyclist
2021년 7월 8일
편집: the cyclist
2021년 7월 8일
If you define the edges, then the widths are determined by the differences between the edges. I don't see how your question makes sense.
Also, you might want to ask a new question. The way you entered this, it is appearing as an "answer" to another question.
Steven Lord
2021년 7월 8일
If you're explicitly setting the bin edges, that fixes the bin widths (potentially to non-uniform values.) So just set the edges.
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!