Obtaining displacement from acceleration with omega 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
댓글 수: 3
darova
2020년 4월 2일
There is connection between displacement and acceleration:
v(i+1) = v(i) + a(i)*dt;
x(i+1) = x(i) + v(i)*dt;
Or am i missing something?
Samuel Bofferding
2020년 4월 3일
Lubos Smolik
2020년 4월 4일
Samuel, have you checked my answer? Is it helpful or do you need more details?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!