Accelerometer Filtering Data - how to find the valid signals frequency?

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!

 Accepted 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.

2 Comments

Thanks for the quick answer!
It was a great approach! I was skeptical about the valid signals below 1 Hz, but you've convinced me. The accelerometer has a DC Offset, so I've redesigned your filter to eliminate it. I'm now making a comparison between using analog and digital filters, and after that I will take the velocity and position using cumtrapz.
Thanks a lot.
As always, my pleasure!
My original design was for a bandpass filter to eliminate the d-c offset, however I wasn’t certain what you wanted. Another way to eliminate the d-c offset is to subtract the mean of the signal.

Sign in to comment.

More Answers (1)

Thanks. Will you please help me understand what is DC offset?

2 Comments

DC offset is a mean amplitude displacement from zero. If the mean amplitude is zero, there is no DC offset.
I believe it is called DC because it is an often continuous signal, of very low frequency (really close to zero).
To eliminate it, I used a bandpass from 0.01 Hz (so I was able to eliminate the DC offset at 0 Hz) to 1.1 Hz (close to the highest frequency of my signal).
@Douglas Montovaneli — Excellent explanation! Thank you!
Actually, what I term the ‘d-c offset’ is the 0 Hz or direct-current (d-c) offset. Another term for what I term the ‘d-c offset’ is the mean offset. If you subtract the mean of your time-domain signal (setting the 0 Hz or d-c to zero), it is much easier to see the other frequency components of your signal.
The bandpass filter approach is an effective way to eliminate it. Another way is simply to subtract it from your time-domain signal.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!