How to find the center point in this plot?
조회 수: 6 (최근 30일)
이전 댓글 표시
This is my plot. How to find the center point available in this plot?

댓글 수: 4
채택된 답변
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);
댓글 수: 0
추가 답변 (1개)
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!