My data looks like this:
frame phi psi
0 68.466774 -58.170494
1 75.128593 -51.646816
2 76.083946 -64.300102
3 77.578056 -76.464218
4 63.180199 -76.067680
5 77.203979 -58.560757
6 66.574913 -60.000214
7 73.218269 -70.978203
8 70.956879 -76.096558
9 65.538872 -76.716568
10 57.107117 -67.572067
11 63.389595 -49.936893
12 83.935219 -65.073227
13 78.492310 -69.225609
14 58.567463 -77.028725
15 60.258656 -85.608917
16 80.604012 -68.479416
17 79.839516 -58.189476
18 68.693405 -66.911407
19 48.195873 -56.744625
20 75.479187 -48.657692
21 80.180649 -69.976234
22 71.216110 -70.213730
23 67.672768 -50.655262
24 55.870106 -63.952560
25 65.091850 -59.066532
26 64.395363 -40.585659
27 80.011673 -56.789768
28 74.003281 -69.651680
29 65.848534 -60.928204
30 65.260933 -78.133301
...
I would like to bin this data following the criteria of a bin for phi and psi values.
I.e. my desired output data would be of the form, if we
choose the bins to have width 10.
phi psi count
-180 -180 464
-170 -170 324
-160 -160 133
...
So, for an AWK script I need a command that will consider $2 and $3 in ranges of e.g. bin width 10:
e.g.
$2<=-170&&$2>=-180&&$3<=-170&&$3>=-180
$2<=-160&&$2>=-170&&$3<=-160&&$3>=-170
$2<=-150&&$2>=-160&&$3<=-150&&$3>=-160
$2<=-140&&$2>=-150&&$3<=-140&&$3>=-150
$2<=-130&&$2>=-140&&$3<=-130&&$3>=-140
$2<=-120&&$2>=-130&&$3<=-120&&$3>=-130
$2<=-110&&$2>=-120&&$3<=-110&&$3>=-120
$2<=-100&&$2>=-110&&$3<=-100&&$3>=-110
$2<=-90&&$2>=-100&&$3<=-90&&$3>=-100
...
and for each of these ranges, I wish to bin (count) the number of data points that fall within each interval. Any help here?
I can sort of see how to count in AWK, but how do you discretise the count in intervals of this kind. e.g how do you loop
with 10 units of change between each loop?
Thanks