Find coordinates at the midpoint of a line.

33 次查看(过去 30 天)
I can plot a line between points (so I know the x and y's of the endpoints). I also know this can give the distance between the points. I'm sure there is a oneline command to calculate the midpoint coordinates. Any help would be appreciated. Thankyou.

采纳的回答

Walter Roberson
Walter Roberson 2011-11-27
[(x1+x2)/2, (y1+y2)/2]

更多回答(1 个)

Ankit
Ankit 2023-1-19
line=[x1 y1;x2 y2]
line=[0 0;10 50];
mid_pt=mean(line)
mid_pt = 1×2
5 25

类别

Help CenterFile Exchange 中查找有关 Environment and Clutter 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by