I'm a beginner in signal processing and have a hard time to filter out environmental noise from the floor vibration data collected using accelerometers.

I have tried using butterworth filter (IIR) and sinc function (FIR) along with some window functions. Yet, I do not see obvious change in the time domain plot nor in the frequency domain plot by just using above-mentioned low pass filter.

The frequency domain plot does show some changes when I use the filter along with the window function. But, when I use inverse fft of the filtered data, the magnitude of the original data is reduced. I am not sure if the filter/ window function is applied correctly.

fs = 1652 Hz
fc = 208 Hz

I'm not sure the right way to determine the cutoff frequency since I am not sure what is acceptable range for passband/stopband ripples.

Here is my sinc filter:

def fir_lowpass(data, fc, fs, nfft):

# Convert to normalized frequency
fc_nor = fc / (fs / 2)

N = nfft

n = np.arange(N)

# Compute sinc filter.
h = np.sinc(2 * fc * (n - (N - 1) / 2))

# Compute hanning window.
w = signal.hann(N)

# Multiply sinc filter with window.
h = h * w

# Normalize to get unity gain.
h = h / np.sum(h)

# Apply filter to data
data = np.convolve(data, h, 'same')

return data

Here is my butterworth filter:

def IIR_lowpass(data, fc, fs):

fc_nor = fc / (fs / 2)              # Normalize cutoff frequency

b, a = signal.butter(5, fc_nor, btype='low', analog=False, output='ba') 

filt_data = signal.filtfilt(b, a, data)

return filt_data

2 Answers 2



  • That you limit yourself to LTI filters.
  • That you can characterize both the noise and the signal of interest.


  • (a) If you want to detect a signal of interest (e.g. detect footsteps), use a matched filter.
  • (b) If you want to estimate the value of such signal, use a Wiener filter.

These are "the best" you can do (under a bunch of assumptions). You will need to measure and characterize your signals (i.e. get an estimate of the power spectral density of noise and signal for (b), for (a) you need the shape of the signal itself.)

  • $\begingroup$ Hi Juan, thank you for your suggestions. I will look into it. $\endgroup$
    – DrakeL
    May 28, 2019 at 2:09

If you are using a MEMS based accelerometer for vibration analysis, then first thing that is needed to be removed is the gravity component (DC component) because it will affect your readings severely.

You can either apply a high-pass filter if it is there on-chip, or collect the raw data and perform z-score normalization before doing any other operation. Either of these two methods will give you accurate outputs and clean signal/spectrum.

Software based filters never really worked for me when it came to accuracy of the vibration signal.

P.S. - In vibration analysis, the way you mount your sensor on the rotating equipment matters a lot when it comes to your sensor capturing noise.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.