How to find the center point in this plot?

조회 수: 6 (최근 30일)
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2013년 2월 12일
댓글: Cameron Burgoni 2018년 4월 9일
This is my plot. How to find the center point available in this plot?
  댓글 수: 4
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2013년 2월 13일
편집: Sabarinathan Vadivelu 2013년 2월 13일
I want to extract the point (x,y) that is available near the center of the square. Also, I have all (x,y) coordinates of the points available in this plot.
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2013년 2월 13일
I need a point that is nearer to the center of the square.

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

채택된 답변

Walter Roberson
Walter Roberson 2013년 2월 13일
minx = min(x);
maxx = max(x);
centx = (minx + maxx) / 2;
miny = min(y);
maxy = max(y);
centy = (miny + maxy) / 2;
dist2 = (x - centx).^2 + (y - centy).^2;
[mindist2, idx] = min(dist2);
bestx = x(idx);
besty = y(idx);

추가 답변 (1개)

Thorsten
Thorsten 2013년 2월 12일
x = rand(1,100);
y = rand(1,100);
plot(x, y, 'r*')
hold on
plot(mean(x), mean(y), 'k*', 'MarkerSize', 20)
  댓글 수: 2
Sabarinathan Vadivelu
Sabarinathan Vadivelu 2013년 2월 13일
I need a point that is nearer to the center of the point in the square. Not to plot an another point in the center.
Cameron Burgoni
Cameron Burgoni 2018년 4월 9일
Did you ever figure this out?

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by