Calculation velocity and acceleration from X and Y coordinates

조회 수: 6 (최근 30일)
Daniel Jara
Daniel Jara 2018년 8월 31일
댓글: Jim Riggs 2018년 8월 31일
Hi, I am trying to calculate the velocity and acceleration of a football player in a 8-minute game. I have computed XY from GPS so I have distances by a 2 matrix (9256x2). I have computed distance with hypot. I have the t (9256x1) variable as well which goes like this [0; 0,05; 0,10; 0,16; 0,21; 0,26; 0,31; 0,36; 0,41; 0,47; 0,52; 0,57; 0,62; 0,67; 0,73; 0,78; 0,83; 0,88; 0,93; 0,99;] and so on.
What I do by now is the following:
% t - tiempo; d - distance between each XY point (obtained from hypotenus)
tdiff = diff(t)
% vel - velocity
vel = d(2:end)./tdiff
figure(1)
plot (t(2:end), vel)
% ac - acceleration
veldiff = diff(vel)
ac = veldiff./tdiff(2:end)
figure (2)
plot (t(3:end), ac)
Velocities seems to be correct, but acceleration data has no sense. Any suggestion? Where do I fail?
Thanks in advance
Daniel.

채택된 답변

Jim Riggs
Jim Riggs 2018년 8월 31일
편집: Jim Riggs 2018년 8월 31일
It appears from the sample data that you show that the time interval is not constant in your data. This will cause some difficulties numerically and limit your options in smoothing the data. Taking a numerical derivative is an inherently noisy process, and so the second derivative is noise upon noise.
I would suggest that you first smooth the position data with a spline curve, then over-sample it at a small time interval. Then you can use higher-order differentiation methods to get smoother data. For example:
%%create the over-sampled time vector
dt = 0.02; % specify the time step you want (should be smaller than the data sampling)
tstart = 0; % specify the starting time value
tstop = ?? % specify the end time value
nsteps = (tstop-tstart)/dt +1 % calculate the number of time steps
tt = linspace(tstart,tstop,nsteps); % create the time vector
Now, using this new time vector, use the spline interpolation to generate smoothed position data:
Xsmooth = spline(t,X,tt);
Ysmooth = spline(t,Y,tt);
Now you have smoothed data for X, and Y (Xsmooth, Ysmooth) on an oversampled time scale, tt. Use this smoothed data to perform your calculations and you should see somewhat better results.
As an alternative, you might try smoothing the data after calculating the distance. Use the original X and Y data to calculate the distances, as before, then smooth and over-sample the distance vector. This might work better;
dsmooth = spline(t,d,tt);
For even more smoothing, you can now use higher-order numerical derivative calculation methods which will provide better results.
  댓글 수: 2
Daniel Jara
Daniel Jara 2018년 8월 31일
I really appreciate your time.
Data XY is derived from GPS devices. I apply a geodesic2enu transformation and the a 4th order Butterworth Low-Filter is applied to XY data in order to obtain smoothed data.
Once I have all data filtered, I go on with the process that I posted above. This non-constant time series are taken from GPS (20hz).
Jim Riggs
Jim Riggs 2018년 8월 31일
I understand. Working with real-world data is full of challenges. I recommend smoothing the data to a uniform time-step, and then using the higher-order central difference formulas to estimate the derivatives.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by