MATLAB: Accelerometer Filtering Data – how to find the valid signals frequency

accelerometerfft

Hello all, I have an 1-axis accelerometer data sample, with a frequency sample of 51,2 kHz, but it has so much noise. I stared calculating and plotting the fft, trying to find the frequencies that I believe it would be valid signals or noises. My question is: Is there a simple way to visualize this? I know I should use a filter to noise filtering, but i can't do this without the information of which frequencies have the valid signals.
I've attached the signal data (.mat) and two pictures, the first one is Time Domain, and the other one the FFT.
Thanks!

Best Answer

I consider signal frequencies to be ‘significant’ if they account for most of the energy in the signal. In yours, they appear to be all frequencies below about 1 Hz.
My approach:
D = load(acc.mat);
acc = D.acc;
Fs = 51.2E+3;
Fn = Fs/2;
Ts = 1/Fs;
L = length(acc);
t = linspace(0, L, L)*Ts;
figure(1)
plot(t, acc)
grid
Facc = fft(acc)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:length(Fv);
figure(2)
semilogx(Fv, abs(Facc(Iv))*2)
grid
Wp = 1/Fn; % Passband Frequencies (Normalised)
Ws = 1.1/Fn; % Stopband Frequencies (Normalised)
Rp = 10; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[z,p,k] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(z,p,k); % Convert To Second-Order-Section For Stability
figure(3)
freqz(sosbp, 2^16, Fs) % Filter Bode Plot
s_filt = filtfilt(sosbp,gbp, acc); % Filter Signal
figure(4)
plot(t, acc, '-b')
hold on
plot(t, s_filt, '-r', 'LineWidth',1.5)
hold off
xlabel('Time')
ylabel('Amplitude')
legend('Original', 'Lowpass Filtered')
It is relatively straightforward to re-design the lowpass filter to a bandpass or other design to get the result you want.