How to get accurate displacement/position from acceleration data?

조회 수: 15(최근 30일)
Jonas 2021년 9월 30일
댓글: Mathieu NOE 2021년 9월 30일
I tried trapz/cumtrapz but seem to be getting wrong and/or inaccurate results. I'm starting out with IMU data from subjects performing a defined task, including walking about 20 metres in one direction. The software outputs acceleration data @200Hz in mG for X Y and Z.
velocity.X = cumtrapz(1/200,acceleration.X/1000*9.81);
volocity.Y = cumtrapz(1/200,acceleration.Y/1000*9.81);
velocity.Z = cumtrapz(1/200,acceleration.Z/1000*9.81);
position.X = trapz(1/200,velocity.X);
position.Y = trapz(1/200,velocity.Y);
position.Z = trapz(1/200,velocity.Z);
distance_travelled = sqrt(positionX^2+positionY^2+positionZ^2);
For instance this gives me 13.9m & 13.2m for one subject, and 4m and 20m for another (they all walked around 20m)
Am I applying the frequency incorrectly? Should I calculate a time-vector first? Is there another problem with this method?
I also tried this answer by another user, which gives me 3.2m and 1.7m for the first subject (13.9m/13.2m)


Mathieu NOE
Mathieu NOE 2021년 9월 30일
I see the same question coming quite often.... when doing acceleration data integration, it is very important to calibrate the sensor .
calibration is the task that will define :
  • what is the voltage output of the sensor at rest (physically). Your output is certainly not truly zero volt, so that dc ofset must be retrieved before you do the integration. otherwise , a dc offset will create a linear drift in the velocity output , which itself create an even faster drift in displacement output (parabolic drift).
  • what is the sensivity of the sensor : this should be defined by the supllier specification, but it's always good to double check. A simple method is to put the senor once top side upward (record output value for +1g acceleration) , once top side downward (record output value for -1g acceleration) . Compute sensivity = difference of the two values /2
  댓글 수: 5
Mathieu NOE
Mathieu NOE 2021년 9월 30일
my bad - my brain exploded without notice
you're completely right and I was wrong regarding the correction factor;
sorry for the confusion
for the restof the code I don't see any mistake ;
if dt = 1/200 you can either use cumtrapz with only dt , or t (time array with resolution dt = 1/200) as first argument (as per the doc)

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




Community Treasure Hunt

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

Start Hunting!

Translated by