Is it possible to compute delay with an IIR filter between peaks

digital filterfilterfiriir

I am developing a project which receives accelerometer signals as input, which must then be analysed via peak-detection algorithms (among other techniques).

In order to do so more effectively, I first filter the signal with a low-pass Butterworth digital filter (an IIR filter) with order 20.

By plotting the signal to a graph, I can then see a delay between the peaks to be detected, which wouldn't matter much if I just needed to detect the peaks themselves.

But since I need to compare the output of this filter with the input and then some other filtered outputs, I need to be able to match these peaks between themselves.

I know this can be done (approximately) with FIR filters by calculating their delay (which is n/2), so I ask: is this possible with an IIR filter?

Filter coefficients:

A = [ 1; -5,98758963; 16,67219332; -28,2587879; 32,15975649; -25,6017496; 14,40568743; -5,647074344; 1,473727937; -0,230919346; 0,016479631 ]

B = [ 1,68E-06; 1,68E-05; 7,58E-05; 2,02E-04; 3,54E-04; 4,24E-04; 3,54E-04; 2,02E-04; 7,58E-05; 1,68E-05; 1,68E-06 ]

Best Answer

It is possible with an IIR filter, but not accurately with a plain Butterworth filter. As far as I can recall, the only IIR filter with flat group delay is the Bessel, whose stopband attenuation is inferior to the Butterworth.

The problem with the Butterworth is that the group delay is a function of frequency, therefore the different frequency components of your peaks are delayed by different times.

One solution is to follow the Butterworth filter with a "group delay equaliser" consisting of approximately as many "all pass" stages as the filter itself. This will give you a good approximation to a constant group delay. I wouldn't presume to advise you on actually designing the equaliser.

All in all, I think the FIR filter is a far simpler approach, as well as more accurate : I don't know why you regard its delay as "approximate".