Calculating distance covered from x and y coordinates

조회 수: 14 (최근 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 CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by