# How to quantify delay in filtered output?

I have a signal containing two sine tones 30 kHz and 60 KHz. I used a second order IIR notch filter to filter out the 60 KHz component from the signal, so now the signal has only 30 KHz component.

When comparing the filtered out signal with a pure 30 KHz tone generated, the earlier samples are very much different but later samples are matching to some good extent.

Plot with earlier samples: Plot with later samples: What are the reasons why there is a delay before response being proper? How can i mathematically quantify this?

Like after how many samples the filtered output will be reasonably matching with that of pure tone?

• Which notch filter did you use? – Rodrigo de Azevedo Oct 26 '17 at 14:57
• Also, if you have discrete-time signals, why are you using Hz as unit of frequency? The unit should be radians. – Rodrigo de Azevedo Oct 26 '17 at 14:58
• @Rodrigo notch filter is second order iir notch filter (used matlab's iirnotch function to generate coefficients) – srk_cb Oct 26 '17 at 15:01
• And what are the coefficients? What is the transfer function? – Rodrigo de Azevedo Oct 26 '17 at 15:07
• @RodrigodeAzevedo coefficients are b = 0.9946 -1.8496 0.9946 a = 1.0000 -1.8496 0.9893 – srk_cb Oct 27 '17 at 4:57

It's the transient and the group delay which are associated with the initial conditions and the LTI filter phase response $\phi(w)$ respectively.
The group delay (in samples) associated with the LTI filter is: $$\tau = - \frac{d \phi(w) }{dw}$$
The output will be shifted by $\tau$ samples wrt to the input. You shall compansate this shift for synchronization.