Locating center of datapoints

조회 수: 5 (최근 30일)
Lily
Lily 2014년 10월 27일
답변: Torsten 2014년 11월 6일
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.

답변 (2개)

Torsten
Torsten 2014년 10월 27일
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.
  댓글 수: 1
Lily
Lily 2014년 11월 6일
Thanks Torsten. But how do you find the unknowns x_c and y_c? I'm assuming that you have to compute them without using Isqnonlin, right?

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2014년 11월 6일
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.

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by