Hello! I am studying the behavior of two centroids (geometric centers) of two soccer teams during a small-sided game. I have already computed the centroids coordinates (x,y) across time and they are stored in my workspace as 'centroidA' (for team A) and 'centroidB' (for team B). Each of the aforementioned variables has several lines and two columns, the first being for the x- coordinates and the second column being for the y- coordinates. I want to verify how much coupled are the two centroids in the x- and y- directions using sample entropy!
I've found this code, but it can only take one time-series:
function [e,A,B]=Samplentropy(y,M,r) %function [e,A,B]=sampenc(y,M,r);
%
%Input
%%y input data
%M maximum template length
%r matching tolerance
%%Output
%%e sample entropy estimates for m=0,1,...,M-1
%A number of matches for m=1,...,M
%B number of matches for m=1,...,M excluding last point
n=length(y);lastrun=zeros(1,n);run=zeros(1,n);A=zeros(M,1);B=zeros(M,1);p=zeros(M,1);e=zeros(M,1);for i=1:(n-1) nj=n-i; y1=y(i); for jj=1:nj j=jj+i; if abs(y(j)-y1)<r run(jj)=lastrun(jj)+1; M1=min(M,run(jj)); for m=1:M1 A(m)=A(m)+1; if j<n B(m)=B(m)+1; end end else run(jj)=0; end end for j=1:nj lastrun(j)=run(j); endendN=n*(n-1)/2;p(1)=A(1)/N;e(1)=-log(p(1));for m=2:M p(m)=A(m)/B(m-1); e(m)=-log(p(m));end
Hope you can help!
Best wishes,
Pedro
Best Answer