I am generating random numbers. The histogram has a sample size of 20 but only 5 bars. How can I control the bar numbers?

 채택된 답변

Sindar
Sindar 2020년 10월 25일

1 개 추천

histogram accepts the number of bins as a second argument:
x = randn(1000,1);
nbins = 25;
h = histogram(x,nbins)

추가 답변 (1개)

drummer
drummer 2020년 10월 25일

1 개 추천

This doc for histogram has the info to play with the number of bins in your histogram
If you're using such command, you can do it by histogram(X, nBinsYouWant)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

태그

질문:

2020년 10월 25일

댓글:

2020년 10월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by