How to use the 2D array point in command window for calculating the total distance covered by the path
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhammad Hayyan Bin Shahid
am 10 Nov. 2021
Kommentiert: Muhammad Hayyan Bin Shahid
am 10 Nov. 2021
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 Kommentare
Akzeptierte Antwort
KSSV
am 10 Nov. 2021
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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!