How to use the 2D array point in command window for calculating the total distance covered by the path

1 次查看(过去 30 天)
Appearing in command window
waypoints =
2.0000 2.0000
2.1271 1.7164
4.3358 7.0825
7.3546 8.8141
10.7270 11.0068
11.0000 11.0000
command to fetch these coordinates and use them to calculate the total distance.

采纳的回答

KSSV
KSSV 2021-11-10
p = [2.0000 2.0000
2.1271 1.7164
4.3358 7.0825
7.3546 8.8141
10.7270 11.0068
11.0000 11.0000] ;
dp = diff(p) ;
d = cumsum(sqrt(dp(:,1).^2+dp(:,2).^2)) ;
d(end)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by