Frequency distribution of monthly data
18 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Star Strider
il 17 Gen 2023
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 Commenti
Star Strider
il 18 Gen 2023
Modificato: Star Strider
il 18 Gen 2023
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.
.
Vedere anche
Categorie
Scopri di più su Line Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!