필터 지우기
필터 지우기

Calculating effective area in Soccer

조회 수: 4 (최근 30일)
William Sheehan
William Sheehan 2018년 4월 20일
댓글: David Goodmanson 2018년 8월 14일
I am currently trying to interpret how to code the attached algorithm (pictured).
Beginning information states "In order to create a polygon on the planar dimension, at least three points are necessary (i.e., triangle). Therefore, three players need to be considered to build triangles as the combinations of N players, in which N is the total number of players within a team."
The algorithm is then given.
I am wondering how this translates into MATLAB.

채택된 답변

David Goodmanson
David Goodmanson 2018년 4월 20일
편집: David Goodmanson 2018년 4월 20일

Hi William,

The algorithm draws a lot of triangles with players at the vertices. I appears that the final result for P is the polygon enclosed by the red boundary in the code below (the convex hull). After that, what the last line is doing is not so clear. Are you just looking for the area inside the boundary? If it's no more complicated than that, then the following code should get it done.

Let the players be at locations (x,y) and let vx be the vector of x coordinates and vy be the vector of corresponding y coordinates. Then

% make up some data
vx = 100*rand(1,11);
vy = 50*rand(1,11);
ind = convhull(vx,vy)             % indices of players on the boundary
plot(vx,vy,'o',vx(ind),vy(ind));
xlim([0 100]);
ylim([0 50]);
A = polyarea(vx(ind),vy(ind))
  댓글 수: 2
William Sheehan
William Sheehan 2018년 4월 21일
Thanks David, that looks awesome!
Is there away to formulate the code in a way that measures the change in area over time, i.e. on a second to second basis over a 30 second window?
I would like to apply this code to different 30 second periods throughout the game using (x,y) coordinate data.
David Goodmanson
David Goodmanson 2018년 4월 21일
Hi William,
that would not be hard to do, you just need vx and vy for each of those one-second intervals. How would you be storing/accessing the vx and vy data?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

William Sheehan
William Sheehan 2018년 4월 21일
Data is collected and exported to excel with a separate spreadsheet for each individual (as pictured). Only values that will be relevant will be the latitude (vx) and longitude (vy) columns. Is it best to create two new spreadsheets - one with all individuals vx values over time side by side and another separate one with all the vy values?
  댓글 수: 8
William Sheehan
William Sheehan 2018년 8월 14일
Hi David,
This appears to work well! Instead of using the area from convhull and the conversion you provided, I am using areaint function with "earthradius" which provides the area in metres squared. Both the results were very similar. Which would be more reliable ?
David Goodmanson
David Goodmanson 2018년 8월 14일
Hi William, probably areaint, since it is part of a Matlab toolbox. According to wikipedia, the earth's radius varies from 6353 km to 6384 km depending on location. For all I know, areaint has a lot of data and uses the radius appropriate to Sydney. earthradius gives 6371. I used 6370 so I would be interested to know how the answers compare if you changed the 6370 I used to 6371.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Antennas, Microphones, and Sonar Transducers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by