Calculating distance covered from x and y coordinates

15 ビュー (過去 30 日間)
Benedict Low
Benedict Low 2016 年 4 月 9 日
コメント済み: Star Strider 2018 年 2 月 23 日
Hi,
I am trying to calculate the distance covered by a footballer in a ten-minute game. I have 3000 x-coordinates and 3000 y-coordinates in a 3000 by 2 matrix. Does anyone know how I can compute the distance covered?
Thank you
Ben

採用された回答

Star Strider
Star Strider 2016 年 4 月 9 日
This would be my approach:
x = randi(99, 1, 100); % Create Data
y = randi(99, 1, 100); % Create Data
d = hypot(diff(x), diff(y)); % Distance Of Each Segment
d_tot = sum(d); % Total Distance
  4 件のコメント
Constance Woodman
Constance Woodman 2018 年 2 月 22 日
I tried this method and it produces a matrix of all possible distances between all stated points, which is cool unless one wanted to use a large data set, and only needed the first column or would crash the computer.
Star Strider
Star Strider 2018 年 2 月 23 日
@Constance —
This code wasn’t written to solve your problem.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by