Foreword: I am a PhD student and fairly unexperienced with many signal processing and engineering concepts, please be gentle.

I am attempting to filter out a frequency range of 1Hz to 2Hz from a 2.4GHz CSI amplitude signal, however after applying a butterworth bandpass filter I observe a large spike at the beginning of my signal. If I remove the first 100 or so samples from my signal, this has no effect on the spike. I have attempted this using both Python (with scipy's lfilter), and MATLAB (with butter and filter), and have observed the same behaviour in both. I am aware there are variations of these filter methods, however perhaps I do not understand which one I should be using. I am attempting to replicate this work.

The signal is comprised of roughly 60 OFDM subcarriers, which are all plotted in my example.


  • buttOrd = 2
  • fcutlow = 1
  • fcuthigh = 2
  • Fs = 9.7


[b, a] = butter(buttOrd, [fcutlow fcuthigh]/(Fs/2), "bandpass");
filterSig = filter(b, a, signal);


b, a = signal.butter(buttOrd, [fcutlow/(Fs/2), fcuthigh/(Fs/2)], "bandpass")
filterSig = signal.lfilter(b, a, signal)

Unfiltered signal

Above: Unfiltered signal.

Filtered signal

Above: Filtered signal.

By reducing the range given to the bandpass filter to something much smaller, like 1Hz-1.01Hz, a smaller, consistent signal can be observed. I understand why a smaller range would produce a different response, but I don't understand the specific behaviour I'm observing.

  • 1
    $\begingroup$ At the beginning you are seeing the output of the filter before it has converged to your signal and is erroneous data that you can exclude. All filters have delay (and memory). So that initial output is not your signal yet and can be excluded. The tighter your filter the more memory is required and hence the longer the delay- you can use the group delay function in matlab mathworks.com/help/signal/ref/grpdelay.html to easily see what your filter delay is. $\endgroup$ Commented Nov 25, 2019 at 12:13
  • $\begingroup$ Also unless you chose an IIR butterworth filter for specific reasons an FIR filter with least squares (firls) is often a better choice (if post-processing subtract the mean to eliminate the DC and use a least-squares low pass filter design using Matlab firls function). $\endgroup$ Commented Nov 25, 2019 at 12:15

1 Answer 1


What you see as a spike at the beginning of the filter output is the impulse response of the bandpass filter itself. This would happen as a transient effect and it will be more pronounced if the filtered signal is sinusoidal + dc in nature. If it were a pure zero mean noise than the spike would be somewhat obscured.

You can either use a group delay shift on the output to extract the relevant portion without that spike, or try to set the initial conditions of the filter to disable the transient reponse but almost always the first approach is preferred.


Your Answer

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

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