Filter löschen
Filter löschen

Calculating distance covered from x and y coordinates

18 Ansichten (letzte 30 Tage)
Benedict Low
Benedict Low am 9 Apr. 2016
Kommentiert: Star Strider am 23 Feb. 2018
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

Akzeptierte Antwort

Star Strider
Star Strider am 9 Apr. 2016
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 Kommentare
Constance Woodman
Constance Woodman am 22 Feb. 2018
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 am 23 Feb. 2018
@Constance —
This code wasn’t written to solve your problem.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by