Frequency distribution of monthly data
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a monthly timetable with some values and I need to calculate the frequency distribution in classes from 0 to 10 with step of 0.1. Right now using tabulate I receive these results.
frequency=(0:0.1:10);
tabulate(TT)
Value Count Percent
0 42832 95.95%
0.1 1549 3.47%
0.2 132 0.30%
0.3 48 0.11%
0.4 26 0.06%
0.5 16 0.04%
0.6 11 0.02%
0.7 2 0.00%
0.8 9 0.02%
0.9 4 0.01%
1 4 0.01%
1.1 3 0.01%
1.2 3 0.01%
1.3 1 0.00%
How can I fill the classes until 10 (even with zeros, in other months I expect to have higher values).
댓글 수: 0
답변 (1개)
Star Strider
2023년 1월 17일
Define the edges as:
Ev = linspace(0, 10, 101)
If you want the frequency (rather than the default 'counts'), choose the 'probability' Normalization option.
.
댓글 수: 8
Star Strider
2023년 1월 18일
편집: Star Strider
2023년 1월 18일
My pleasure!
Yes. The bins are an array that go from 0 rainfall to the maximum rainfall (‘ceil(Rainmax)’ so 5 here) in the entire timetable. The limits can be anything that works, so 10 is also an acceptable option for the upper limit of ‘Edges’. I chose the upper limit here to increase the resolution so the individual bars would be easier to see.
Also, the ‘Binv’ cell array stores the bin indices (in this instance, indices into the the dates and times for each month) that contributed to each bin. I don’t know if that’s important, however the histcounts function produces it, so I returned it and saved it.
EDIT — (18 Jan 2023 at 21:57)
When I re-ran my code just now and viewed it,, ‘Nv’ is a (12x1) cell array.
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Preprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!