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.
0 个评论
采纳的回答
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 Center 和 File 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!