To selectively pass or attenuate particular frequency components, a digital filter must examine a sequence of samples over time rather than a single instantaneous input value. Therefore, a causal digital filter stores past input samples and, in the case of an infinite impulse response (IIR) filter, past output samples as well. It calculates the current output by forming a weighted sum of these stored values. This operation is represented by a difference equation and necessarily involves one or more unit-delay elements.
A delay of (k) samples in the time domain corresponds to the frequency-dependent phase factor (e^{-j\omega k}) in the frequency domain. Consequently, a filter that combines signal components having different delays generally has both a magnitude response and a phase response, thereby introducing phase delay and group delay into its output.
In a linear-phase finite impulse response (FIR) filter, the group delay is constant over the relevant frequency range. The waveform is therefore delayed as a whole without being distorted. In contrast, a conventional IIR filter generally has a frequency-dependent group delay. Different frequency components are delayed by different amounts, altering their original temporal relationships and producing phase distortion. Thus, the principal concern is not the existence of delay itself, but the variation in group delay with frequency.
Our products use forward–backward filtering with the filtfilt function to eliminate the phase distortion and group delay introduced by the IIR filter. However, this operation results in an overall magnitude response equal to the square of the original filter’s magnitude response. Moreover, filtfilt does not automatically correct the intrinsic group-delay structure of the input signal or any phase and group-delay distortions already introduced by the measurement system.
Homer3 also uses filtfilt to achieve zero-phase filtering, but it does not compensate the cutoff frequencies or attenuation characteristics for the squared magnitude response caused by forward–backward filtering. Therefore, when accurate preservation of phase relationships and precise control of the magnitude response are particularly important in fNIRS signal analysis, a properly designed linear-phase FIR filter is recommended, despite its greater computational cost.
