Calculate radius from scatter plot
12 次查看(过去 30 天)
显示 更早的评论
Hi,
I need to calculate the radius of a circle, ignoring all surrounding particles (image attached). The circle itself consists of many particles (over 100,000). Note that the center of the circle is not at the origin.
Thanks.
EDIT: here is how I solved it:
posn=normal(poscm); %poscm is the coordinates matrix
[k,edges]=histcounts(posn,1e5);
[~,imaxk]=max(k);
R=edges(imaxk+find(k(imaxk:end)==0,1)); %find the first zero value after the maximum
5 个评论
Adam Danz
2020-6-23
If you're still looking for a solution, attach the fig file containing the data, or attach a mat file containing the (x,y) coordinates.
回答(3 个)
Matt J
2020-6-22
You could try using clusterdata to find the big concentration of points. Then minboundcircle from the File Exchange to get the radius,
darova
2020-6-23
Try density function hist3
r = rand(500,1)/5;
t = rand(500,1)*2*pi;
x = [rand(50,1); r.*cos(t)+0.5];
y = [rand(50,1); r.*sin(t)+0.5];
n = 20;
k = hist3([x y],[n n]);
k(k<2) = nan;
pcolor((0:n-1)/n,(0:n-1)/n,k)
hold on
plot(x,y,'.r')
hold off
4 个评论
darova
2020-6-24
Here is the idea
- scale your data
- create an image (fill pixels)
- dilate image to create solid round object (circle)
- use imfindcircles
5 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!