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 endDisVek = 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