Correct histogram - with hist,histc ?
이전 댓글 표시
My textbook say,the correct histogram is that when the bars width is same in the histogram graph.
And show how to make correct histogram in ML for two type of data.
1.) when the classes are the same width
frekvenci = hist(data,k);
[frekvenci, reprezentatntclasses] = hist(data,k);
I tried in example,but I dont know is good way because I didnt get figure with graph ?!?
clear,clc
data = rand(100,1)*750;
k = 10;
pt = hist(data,k)
[pt, rt] = hist(data,k)
2.) when classes isnt the same width
ht = [. .. ..] %binranges
frekvencie = histc(data,ht)
width = ht(2:end) - ht(1:end-1) %width classes
nor = frekvencie(1:end-1)./width %normaziation fkrev.classes
bar(ht,nor,'histc')
in concrate example I tried:
clear,clc
data = rand(100,1)*750;
ht = [0 100 200 300 500 ];
pt = histc(data,ht)
sum(pt)
sirky = ht(2:end) - ht(1:end-1)
upt = pt(1:end-1)./sirky %here I get dimension error ?!? how can I solve this error
bar(ht,upt,'histc')
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!