how to count the number of scatter points in a each sector region of the 6 concentric circles ?
2 次查看(过去 30 天)
显示 更早的评论
I have found the scatter points in a graph but i need to find the number of scatter points lies inside of the sector region of the circle in the form of percentage ? i have attached the sample answer graph for this question(fig2).
0 个评论
采纳的回答
Image Analyst
2022-12-5
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 个评论
Image Analyst
2022-12-5
编辑:Image Analyst
2022-12-5
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
更多回答(1 个)
KSSV
2022-12-5
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!