# How to implement one dimensional low pass Gaussian filter with zero-phase shift?

I am trying to apply a low pass Gaussian filter on a signal and find the exact location of maximum/minimum in the resulting smoothed signal. I have to do it for a few values of sigma (Gaussian bandwidth).

How is it possible to implement such Gaussian filtering and compensate phase shifts during filtering so that I can find the exact location of extrema as an index of signal location?

### Appendix:

I have tried:

1) Convolution with a low pass Gaussian kernel (windowing) results in extension of resulting signal length which makes it impossible to find extremum as an index of original signal.

2) use of Fourier transform on signal and kernel and multiplication in Fourier domain makes the resulting signal in time domain circulary shifted.

• are you doing it in real time? – Irreducible Mar 26 '19 at 7:24
• One way to realize zero-phase digital filtering (offline) is to filter in both the forward and reverse direction – Irreducible Mar 26 '19 at 7:48
• why does the length extension resulting from convolving with a Gaussian kernel make it impossible to find the extremum relative to the original index? you know the length of the Gaussian kernel. if it's symmetric, then the index of the extremum is offset by half of that length. – robert bristow-johnson Mar 26 '19 at 7:49
• @Irreducible, since the Gaussian kernel is already symmetric. it's already linear phase. simply subtracting half of the length will return it to zero phase. filtfilt is not necessary for symmetric FIR filters. – robert bristow-johnson Mar 26 '19 at 7:51
• @M.Jalali, As robert and irreducible said, if the kernel is symmetric then subtract half its length, if its not symmetric then run it both directions. – Digiproc Mar 26 '19 at 9:51