How to create a histogram for given data ??

Hi all! Let's say I have 2 set of numbers;
A = 3, 5, 7, 9
B = 2000, 2010, 2020, 2030
My question is how can I create a histogram such that A would be on the x-axis and B would be on the y-axis. Thanks.

댓글 수: 3

bar([2000:10:2030]',[3:2:9]')
maybe?
EMRE
EMRE 2013년 9월 29일
Can I do the same thing by using hist() function ? If yes how ? :)
Image Analyst
Image Analyst 2013년 9월 29일
What do you want to take the histogram of? We were assuming that A was already the histogram - the counts - and that B was the bin centers.

댓글을 달려면 로그인하십시오.

답변 (1개)

Wayne King
Wayne King 2013년 9월 29일

1 개 추천

As dpb has told you, use bar()
A = [3 5 7 9];
B = [2000 2010 2020 2030];
bar(A,B,'barwidth',0.4)
set(gca,'ylim',[1990 2050])

댓글 수: 1

EMRE
EMRE 2013년 9월 29일
Can I do the same thing by using hist() function ? If yes how ? :)

댓글을 달려면 로그인하십시오.

카테고리

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

태그

질문:

2013년 9월 29일

댓글:

2013년 9월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by