MATLAB: Obtaining displacement from acceleration with omega arithmetic

fftomega arithmetic

Hi everyone,
I have read on different posts, that another method to obtain the displacement from the acceleration is by using omega arithmetic. I have tried different techniques, however I get very confusing information / results. I am getting the accelerometer data from a tri-axis accelerometer, for which I use a sampling frequency of 400Hz. I have written the following code:
Fs = 400; %Sampling frequency from my Accelerometer
Fn = Fs/2; %Nyquist Frequency
dt = 1/Fs;
N = numel(Time); % Amount of Samples
%First I am doing a High-Pass-Filter on my data, using the Buttord, butter, zp2sos and filtfilt functions
Wp = [5.0/400 20.0/400]; % Passband (Hz)
Ws = [0.1/400 40.0/400]; % Stopband (Hz)
Rp = 1; % Passband Riple (dB)
Rs = 10; % Stopband Riple (dB)
[n,Wn] = buttord(Wp,Ws,Rp,Rs);
[z,p,k] = butter(n,Wn);
[sos,g] = zp2sos(z,p,k);
AccelVek_filtered = filtfilt(sos,g,AccelVek); %AccelVek is three dimensional (Acc_x, Acc_y and Acc_z in each column for the given Time)
% Next doing the FFT
NFFT = 2^nextpow2(N);
AFFT = fft(AccelVek_filtered, NFFT)*dt; %dAccelVek_filtered is simply the acceleration filtered using filtfilt
f_fft = Fs*(0:NFFT-1)/NFFT; % Frequency
omegai = 2*pi*Fs*sqrt(-1); % Omega to use in the Frequency domain
% dividing by omega*i^2
for i = 1:NFFT
if f_fft(i) > 10 && f_fft(i) < Fn
DFFT(i,1) = AFFT(i,1)/(omegai^2);
DFFT(i,2) = AFFT(i,2)/(omegai^2);
DFFT(i,3) = AFFT(i,3)/(omegai^2);
else
DFFT(i,:) = 0;
end
end
DisVek = ifft(DFFT, N)*Fs; %Transforming it back using ifft
I know it is a pretty long code, but my results don't seem to make sense. Could someone please have a look and tell me if i made a mistake somewhere?
Thank you 🙂
Sam

Best Answer

Hello Samuel!
If you want to perform a single integration in the frequency domain, you have to multiply each spectral line by
1 ./ (2i * pi * f_fft),
where f_fft is a frequency of the spectral line rather than the sampling frequency.
For a full code, please refer to this submission: autoFFT
EDIT: Moreover, there is no need for low-pass filtering if you do not want to apply, e.g. frequency zoom. Note that each filter can alter magnitudes and phases of components in your signal and it in turn adds some degree of uncertainty to your experimental data. If you measure vibrations, it is usually better to perform only analog anti-aliasing filtering (your analyser should do it) and digital or analog high-pass filtering. If you do not need higher frequencies, you can discard them after the Fourier transform.
Related Question