How to implement either a High/Low Pass filter on accelerometer data.
51 views (last 30 days)
I have collected data from an accelerometer and have been reading and attempting to understand past posts for hours now however I don't believe I know enough about signal processing to properly implment the filter I need. For my accelerometer, I set the output data rate to 50hz so the bandwidth would be 25hz and sampled at 10hz (10 times /sec) to account for Nyquist.
My data is highly noisy and I am trying to extract frequencies which based on similar research in my field should be between 0.1-1hz range. Also from research papers I've read it seems previous research either uses a high pass butterworth filter or a lowpass filter.
I have implemented an FFT first however I'm not quite sure how to discern it and accuratley apply a filter passing the signal in the desired range through to obtain a filtered dataset. I'll provide an image and code below (not sure if correct).
I would really appreciate if someone would step me through how to implement a filter on my dataset so I can clearly discern the peak frequencies in my data and have a filtered dataset going foward. I'm pretty amateur to both signal processing and Matlab! Thank you, I'd really like to understand it.
X = readmatrix('30min.CSV');
Y = fft(X);
L = 133361; %Length of matrix
Fs = 10; %Sampling Frequency (hz)
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
title("Single-Sided Amplitude Spectrum of X(t)")
Star Strider on 28 Sep 2022
‘For my accelerometer, I set the output data rate to 50hz so the bandwidth would be 25hz and sampled at 10hz (10 times /sec) to account for Nyquist.’
It is difficult for me to interpret this. If the sampling frequency is 50 Hz, the Nyquist frequency is 25 Hz, so it should be relatively straightforward to filter a signal in the range of 0.1 Hz to 1 Hz.
The signal appears to have broadband noise. The easiest way to eliminate that is with the Savitzky-Golay filter (sgolayfilt function) since a frequency-selective filter will passd the noise as well as the signal in its passband. Use the bandpass , highpass or lowpass functions for the other filtering, and specify 'ImpulseResponse','iir' for best results. Those functions will design a very efficient elliptic filter for each.