| Signal Processing Toolbox™ | ![]() |
y = filtfilt(b,a,x)
y = filtfilt(b,a,x) performs zero-phase digital filtering by processing the input data in both the forward and reverse directions (see problem 5.39 in [1]). After filtering in the forward direction, it reverses the filtered sequence and runs it back through the filter. The result has precisely zero-phase distortion, the magnitude is the square of the filter's magnitude response, and the filter order is double the order of the filter specified by b and a. filtfilt minimizes start-up and ending transients by matching initial conditions, and works for both real and complex inputs.
Note that filtfilt should not be used with differentiator and Hilbert FIR filters, since the operation of these filters depends heavily on their phase response.
Note The length of the input x must be more than three times the filter order, which is defined max(length(b)-1,length(a)-1). The input x should be large enough so that the impulse is correctly represented. For example, for a fifth order filter, if the input sequence is a delta sequence, the 1 value should appear within the first 15 samples. |
filtfilt is an M-file that uses the filter function. In addition to the forward-reverse filtering, it attempts to minimize startup transients by adjusting initial conditions to match the DC component of the signal and by prepending several filter lengths of a flipped, reflected copy of the input signal.
[1] Oppenheim, A.V., and R.W. Schafer, Discrete-Time Signal Processing, Prentice-Hall, 1989, pp.311-312.
[2] Mitra, S.K., Digital Signal Processing, 2nd ed., McGraw-Hill, 2001, Sections 4.4.2 and 8.2.5.
[3] Gustafsson, F., Determining the initial states in forward-backward filtering, IEEE® Transactions on Signal Processing, April 1996, Volume 44, Issue 4, pp.988–992.
![]() | filternorm | filtic | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |