Players distribution in soccer field

조회 수: 3 (최근 30일)
Sérgio Querido
Sérgio Querido 2015년 4월 16일
댓글: Image Analyst 2015년 4월 19일
Hello,
I have the coordinates (x,y) of a lot of soccer players and i want to know their field distribution. I want to part the field (120m x 90m) in 1m2 bens. With this, i want to now how many times, players are in each bens.
Can you help me please with the best code to run this in matlab?
SQ

채택된 답변

Image Analyst
Image Analyst 2015년 4월 17일
If you have the Statistics and Machine Learning Toolbox you can use hist3: http://www.mathworks.com/help/stats/hist3.html?s_cid=srchtitle which looks just like what you want and need.
  댓글 수: 2
Sérgio Querido
Sérgio Querido 2015년 4월 19일
How can i run ndhist.m's code with my requirements? - table size: 120m x 90m (the same size of soccer field) - Bean size: 1m2 - The (x,y) referencial point (0,0) is in the centre of de field.
Image Analyst
Image Analyst 2015년 4월 19일
If xy is your N by 2 matrix of x and y locations for the players (each player is one row), then, if you have the Statistics and Machine Learning Toolbox, do this:
hist3(xy,[120, 90])
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
numberOfPeopleOnField = 1000;
% Make up some X coordinates for numberOfPeopleOnField people.
x = 120 * rand(numberOfPeopleOnField, 1);
% Make up some Y coordinates for numberOfPeopleOnField people.
y = 90 * rand(numberOfPeopleOnField, 1);
xy = [x, y];
hist3(xy,[120, 90])
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Count (# of People)', 'FontSize', fontSize);
You'll note that most 1 square meter regions have only 0 or 1 plyaer in them. I had to put a lot of players on the field to get more than 2 playes in a 1 square meter square.

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

추가 답변 (1개)

Sérgio Querido
Sérgio Querido 2015년 4월 19일
How can i run ndhist.m's code with my requirements? - table size: 120m x 90m (the same size of soccer field) - Bean size: 1m2 - The (x,y) referencial point (0,0) is in the centre of de field.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by