How to use the 2D array point in command window for calculating the total distance covered by the path
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muhammad Hayyan Bin Shahid
le 10 Nov 2021
Commenté : Muhammad Hayyan Bin Shahid
le 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 commentaires
Réponse acceptée
KSSV
le 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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!