2
$\begingroup$

I have a list of polar coordinate points:

list = Transpose[Join[RandomReal[{1, 60}, {1, 100}], RandomReal[{0, 2 Pi}, {1, 100}]]]

I need to divide the circle into 16 angle sectors (Range[0, 2 Pi, 2 Pi/16]) and 4 radius sectors (Range[0, 100, 25]). I need to count the number of points that fallen into each two-component sector (there are $16\times4 = 64$ such two-component sectors).

$\endgroup$

3 Answers 3

4
$\begingroup$
BinCounts[list, {0, 100, 25}, {0, 2π, π/8}] //MatrixForm

$\left( \begin{array}{cccccccccccccccc} 4 & 2 & 1 & 2 & 2 & 3 & 4 & 2 & 4 & 0 & 1 & 4 & 2 & 2 & 1 & 3 \\ 4 & 3 & 2 & 3 & 3 & 0 & 3 & 2 & 4 & 2 & 2 & 0 & 3 & 4 & 1 & 4 \\ 2 & 1 & 1 & 0 & 3 & 2 & 1 & 3 & 3 & 0 & 1 & 3 & 0 & 3 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$

$\endgroup$
1
  • $\begingroup$ this solution is not complete! It gives jut 16 sectors $\endgroup$ Commented Jan 9, 2016 at 2:19
1
$\begingroup$
list = Transpose[{RandomReal[{1, 60}, 100], RandomReal[{0, 2 Pi}, 100]}];

BinCounts[#[[All, 2]], {0, 2 Pi, 2 Pi/16}] & /@ Partition[list, 25] // MatrixForm

enter image description here

$\endgroup$
1
$\begingroup$

also:

HistogramList[list, {{0, 60, 15}, {0, 2 Pi, Pi/8}}][[2]]

reading again, the r bin should be {0,100,25}. The last bin will of course be empty since your random data ends at 60

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.