MATLAB's filtfilt does a forward-backward filtering, i.e., filter, reverse the signal, filter again and then reverse again. Apparently this done to reduce phase lags? What are the advantages/disadvantages of using such a filtering (I guess it would result in an effective increase in filter order).

Would it be preferable to use filtfilt always instead of filter (i.e., only forward filtering)? Are there any applications where it is necessary to use this and where it shouldn't be used?

  • 1
    $\begingroup$ Don't use zero-phase filtering for audio, as it causes "pre-ringing" that sounds odd. Minimum-phase filtering is more natural. ccrma.stanford.edu/~jos/filters/Linear_Phase_Really_Ideal.html $\endgroup$
    – endolith
    May 20, 2014 at 21:26
  • $\begingroup$ A use case is a centered moving average, which corrects for phase shift introduced by a moving average done using a causal filter. $\endgroup$
    – mins
    Jan 25 at 13:59

2 Answers 2


You can best look at it in the frequency domain. If $x[n]$ is the input sequence and $h[n]$ is the filter's impulse response, then the result of the first filter pass is


with $X(e^{j\omega})$ and $H(e^{j\omega})$ the Fourier transforms of $x[n]$ and $h[n]$, respectively. Time reversal corresponds to replacing $\omega$ by $-\omega$ in the frequency domain, so after time-reversal we get


The second filter pass corresponds to another multiplication with $H(e^{j\omega})$:


which after time-reversal finally gives for the spectrum of the output signal

$$Y(e^{j\omega})=X(e^{j\omega})H(e^{j\omega})H(e^{-j\omega})= X(e^{j\omega})|H(e^{j\omega})|^2\tag{1}$$

because for real-valued filter coefficients we have $H(e^{-j\omega})=H^{*}(e^{j\omega})$. Equation (1) shows that the output spectrum is obtained by filtering with a filter with frequency response $|H(e^{j\omega})|^2$, which is purely real-valued, i.e. its phase is zero and consequently there are no phase distortions.

This is the theory. In real-time processing there is of course quite a large delay because time-reversal only works if you allow a latency corresponding to the length of the input block. But this does not change the fact that there are no phase distortions, it's just an additional delay of the output data. For FIR filtering, this approach is not especially useful because you might as well define a new filter $\hat{h}[n]=h[n]*h[-n]$ and get the same result with ordinary filtering. It is more interesting to use this method with IIR filters, because they cannot have zero-phase (or linear phase, i.e. a pure delay).

In sum:

  • if you have or need an IIR filter and you want zero phase distortion, AND processing delay is no problem then this method is useful

  • if processing delay is an issue you shouldn't use it

  • if you have an FIR filter, you can easily compute a new FIR filter response which is equivalent to using this method. Note that with FIR filters an exactly linear phase can always be realized.

  • $\begingroup$ I created a tag named maximum-aposteriori-estimation. Could you please rename it into maximum-a-posteriori-estimation? By mistake I forgot the - after the a. Thank You. $\endgroup$
    – Royi
    Sep 27, 2017 at 12:39

I found this video to be very, very helpful (it elaborates on Matt's answer).

Here are some key ideas from the video:

  • Zero-phase will result in no phase distortion, but will result in a non-causal filter. This means that if the data is being filtered as it's gathered, this will not be an option (only valid for stored data which we can post-process).enter image description here
  • When you implement a non-causal filter, transients get blurred forwards and backwards (e.g. if we want a 2dB ripple, the fact that we're going to be making a forward and backward run using the filter means that we'll want each of these to have 1dB).enter image description here
  • Uses the time-reversal property of the discrete-time Fourier transform. enter image description here
  • The effective frequency response caused by FILTFILT is the magnitude of that in one direction, squared. You take your input signal, x[n], filter it, reverse the result, filter it again, and reverse it again (the time-reversal step requires that all data be available).enter image description here

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.