Ensuring Causality and Minimizing Phase Distortion in bst_bandpass_fft Function

Hello fellow forum members,

I'm currently working with the bst_bandpass_fft function and I have a question about ensuring causality and avoiding phase distortion in its output. My goal is to better understand the measures taken by this function to maintain the integrity of the signal's phase while applying the FFT.

Specifically, the function mentions that it uses a "causal FFT algorithm," which is said to result in "no phase shift." I'd like to delve deeper into how this is achieved within the function.

Could someone shed light on the techniques or methods employed by bst_bandpass_fft to maintain causality and minimize phase distortion? Are there specific filter design principles or parameters I should be aware of?

Your insights and expertise would be greatly appreciated as I explore this aspect of signal processing. Thank you in advance for your assistance.

Be aware that the default bandpass filter implementation in Brainstorm is not performed with bst_bandpass_hfilter

A FIR filter is computed using the fir2 function. Because this filter is causal, it introduces a phase-shift (i.e., it has its frequency response has a phase slope). In the time domain, this is observed as a delay in filtered signal compared with the original. One way to make this filter zero-phase is to make its phase slope equal to zero, i.e., this happens in the line H = abs(fft(H)).

This filter is not causal anymore, zero-phase filter cannot be causal.

Another common way to make a zero-phase filter is to filter the signal two times, once forward and once in reverse, see the filtfilt function. On the second filtering run, the filter takes samples from the future, thus again, it is not causal.

Some DSP resources: