# how to count the number of scatter points in a each sector region of the 6 concentric circles ?

10 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Image Analyst
on 5 Dec 2022

If you have the x and y points then you can get the angle of each point using atand

angles = atand(y ./ x)

Then you can take the histogram

counts = histcounts(angles, 8)

percents = 100 * counts / numel(x)

##### 2 Comments

Image Analyst
on 5 Dec 2022

Edited: Image Analyst
on 5 Dec 2022

What does each row and column represent? For example if column 1 is x and column 2 is y, what do the other 199 columns represent?

Attach your matrix with the paperclip icon.

So do you want a count for each radius range and each of 4 angle sectors. Then you need to compute the radius of each point.

radii = sqrt(x.^2 + y.^2);

and compute edges for the angles and radii and then use

help histogram2

### More Answers (1)

KSSV
on 5 Dec 2022

Let (x,y) be your scattered points.

C = [mean(x) mean(y)] ; % center of circle. This would be (0,0)

R = 200 ; % RAdius of circle

d = sqrt((C(1)-x).^2+(C(2)-y).^2) ; % distance of each point from circle center

idx = d <= R ; % points lying inside circle of radii R

nR = nnz(idx)*100/length(x) % percentage of points lying inside circle of radius R

##### 0 Comments

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!