normalize a histogram in matlab 2013b

조회 수: 2 (최근 30일)
Sajid Afaque
Sajid Afaque 2020년 6월 12일
답변: Walter Roberson 2020년 6월 12일
hello all ,
i need the same that is my y axis should be in probability and my x-axis should remain same (not the number of bins).
since their is no direct normalization function in 2013b version i am using
h = hist(z);
h =h/sum(h);
bar(h);
using bar(h) i get my y axis in probabilities,but my x-axis limits to number of bins. i need the x-asix range same as the one i get when i do hist(z).
in advance ,thanks for the help

채택된 답변

Walter Roberson
Walter Roberson 2020년 6월 12일
[h, x_centers] = hist(z);
h = h/sum(h);
bar(x_centers, h);

추가 답변 (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