Motion Tracking with Accelerometer
34 views (last 30 days)
Show older comments
Hi, I'm very new to coding and accelerometer studies, so any help is appreciated.
I have a device that has only one 3-axis accelerometer, no gyroscope, no magnetometer. After doing movements, I get a csv file with accelerations in x,y,z axes. I want to plot the movements that I did from these data in 3d. I am able to read the files on matlab, filter the noise, and use cumtrapz to get velocity and displacement. But these plots are not helpful, and I don't know how to proceed from here.
How do I track the motion of the device and basically recreate the 3d motion plot?
The figure below shows the plots of x, y and z acceleration, velocity and displacement. Thank you.
5 Comments
James Tursa
on 30 May 2020
Edited: James Tursa
on 30 May 2020
A quiescent period would allow you to calibrate so you know the sensor biases + gravity. For a rough result, you would just subtract the beginning value (or probably an average of some beginning values) from all of the data. This ignores the fact that the object is actually moving because of Earth rotation (there is in reality a non-zero component of centripetal acceleration present), but for your purposes I am assuming you can ignore that. You would need to decide that.
Without the quiescent period you don't have this information. So in that case you will have to use a formula for the gravity and use your best judgement for direction based on the test setup.
Answers (1)
Star Strider
on 27 May 2020
The cumtrapz results do not appear to be accumulating with respect to time. Without being able to see the data or your code, my guess is that you are not integrating across the time dimension. The third argument to cumtrapz is the dimension (with time being the first argument and your signal being the second argument). Check to be certain that you are integrating across the correct dimension, then see if the results change.
The ‘x’ result should probably look something like this simulation:
t = 0:10;
xacc = t.*cos(t*2*pi/9);
xvel = cumtrapz(t, xacc);
xdis = cumtrapz(t, xvel);
figure
subplot(3,1,1)
plot(t, xacc)
title('Acc')
subplot(3,1,2)
plot(t, xvel)
title('Vel')
subplot(3,1,3)
plot(t, xdis)
title('Dsp')
.
2 Comments
Star Strider
on 27 May 2020
‘But still, how do I convert this into a precise 3d animation of the exact movements that I did with the device?’
What you read somewhere is correct, however the might be a way to get something out of the data you have.
I have no idea what you want to animate, however using the animatedline function (R2014b and later versions) would be the place to start.
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!