how to convert a accelerometer data to displacements

190 views (last 30 days)
I have an accelerometer data which i have collected from gyroscope. I like to convert those acceleration to displacements as disturbances for calculating the dynamics of suspension. The problem is when i tried to convert the acceleration data to displacement by using two integrators in series the displacement data seems non realistic. In actual acceleration data i found there are decelerations as well but in displacement output i see all positive values. Please suggest me some techniques.......
  4 Comments
Mahshid karimi
Mahshid karimi on 2 Apr 2015
How we can do spotting any trends in FFT peaks as a "function" of water depth Using function command?

Sign in to comment.

Accepted Answer

Dr. Seis
Dr. Seis on 6 Oct 2011
Doing this sort of conversion is best done in the frequency domain. This should work now. Two things weren't working before:
1. Before I defined N as "nextpow2(N1)" instead of "2^nextpow2(N1)
2. I forgot to handle the case where f(i) = 0, we cannot divide by 0 !!
function disp_time_data = acc2disp(acc_time_data,dt)
% acc_time_data should be acceleration amplitudes evenly spaced in time
% dt in units of seconds per sample
N1 = length(acc_time_data);
N = 2^nextpow2(N1);
if N > N1
acc_time_data(N1+1:N) = 0; % pad array with 0's
end
df = 1 / (N*dt); % frequency increment
Nyq = 1 / (2*dt); % Nyquist frequency
acc_freq_data = fftshift(fft(acc_time_data));
disp_freq_data = zeros(size(acc_freq_data));
f = -Nyq:df:Nyq-df; % I think this is how fftshift organizes it
for i = 1 : N
if f(i) ~= 0
disp_freq_data(i) = acc_freq_data(i)/(2*pi*f(i)*sqrt(-1))^2;
else
disp_freq_data(i) = 0;
end
end
disp_time_data = ifft(ifftshift(disp_freq_data));
disp_time_data = disp_time_data(1:N1);
return
Try my sine wave example:
dt = 0.01; % seconds per sample
N = 512; % number of samples
t = 0 : dt : (N-1)*dt; % in seconds
wave_freq = 1; % in Hertz
acc_time_data = sin(2*pi*wave_freq*t);
The numerical answer obtained should be close to the analytical result by double-integrating by hand, i.e.:
disp_time_data_analytical = -1/(2*pi*wave_freq)^2*sin(2*pi*wave_freq*t);
The difference comes from the fact that we are chopping off the sine wave abruptly. You will notice that the "true" answer is super-imposed on a low-frequency sine wave - this is why it may be important to run a high-pass filter on the displacement result. It is possible to avoid this by removing any trend from the data, tapering each side of your timeseries down to 0, and then padding each side evenly with 0's (up to the next power of 2) before "converting" from acceleration to displacement.
  11 Comments
John
John on 14 Feb 2018
I believe you need to set disp_freq_data(1) to zero also.
MANTHAN SHAH
MANTHAN SHAH on 28 Jun 2022
Hello Dr. Seis, Thanks for answering this. I appreciate your efforts towards the community. I am new with Matlab and working with vibrational data too. I was wondering how to tune the displacement data we get? As the output from this code is completely different from what it supoosed to be.

Sign in to comment.

More Answers (1)

Fangjun Jiang
Fangjun Jiang on 6 Oct 2011
There is really no solution for this problem except that you need to check the quality of your accelerometer signal data. Is it noisy?
You can make up an ideal acceleration signal first and feed that signal to you double-integrator model to verify that you have everything right, for example, sample time, initial value, coefficient, etc.
  14 Comments
Mohamed Sayed
Mohamed Sayed on 3 Dec 2013
could you please re-share the uploaded file again with us, as i think the (4shared) link you are sharing is expired. thanks in advance.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!