2
$\begingroup$

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
$\endgroup$
3
$\begingroup$

Assuming:

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

Then:

  • (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.)

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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