Locating center of datapoints
5 views (last 30 days)
Show older comments
I want to find the center of data (X and Y coordinates) and if all data points are plotted the outer line represents a circle. Here is my problem, the data contains outlaws (one or more points that do not fall within the circle) also the circles outlines are of different size veering from 3cm to 6cm in diameter. What is the best way to solve this problem with general algorithm?
I know that the radius of circle is: r = sqrt((X - Xcenter).^2 + (Y - Ycenter).^2) and that I need to find the optimal r which is between 3cm/2 and 6cm/2 but also I need to located the exact center of the datapoints.
Note that the data points are not evenly distributed within the circle.
All hints / solutions are greatly precipitated.
0 Comments
Answers (2)
Torsten
on 27 Oct 2014
Use lsqnonlin for the problem
min: sum_{i=1}^{N} ((x_i-x_c)^2+(y_i-y_c)^2-R^2)^2
where (x_i,y_i) are your data points.
The unknowns are x_c, y_c and R where (x_c,y_c) is the center of the circle and R is its radius.
Best wishes
Torsten.
Torsten
on 6 Nov 2014
The problem you described is different from what I thought at the first glance and looks quite tough to me.
You may want to perform a Google search for
"enclose the maximum number of points by a circle with given radius".
The link
seems to provide an algorithm written in C to solve this problem.
You can look at the solution for different radii and choose the one that fits your needs best.
Best wishes
Torsten.
0 Comments
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!