Practical use of Phase Delay for IIR Filter on Pure Sinusoid
Show older comments
I recently asked a question about Finding Dominant Frequency and Phase using FFT. My follow-up question has to do with the phase shift induced by an IIR filter. For example, consider a situation where I want to forecast a signal into the future. The original, noisy signal gets filtered (Row 1). The dominant frequency is determined (Row 2). The phase angle of the dominant frequency is determined (Row 3). Finally, the forecasted signal is aligned with the filtered signal based on the phase angle to the dominant frequency (Row 4).

However, the true goal is to align the forecasted signal with the original signal, but I don't understand how—other than empirically—to determine the phase shift. Is this information in phasedelay() (below)?

This essentially results in two phase shifts of the forecasted signal: one based on the original signal's phase (gathered from fft()), one to correct for the shift due to the IIR (unsure about this).
3 Comments
Mathieu NOE
on 6 Oct 2020
Hello
remember that sine wave are represented in frequency domain as complex numbers. when you filter a signal the output signal phase is the sum of all rotations induced by applied filters.
you shall compute the gain and phase of the applied filter (at the sine wave frequency)
if you wish to align the raw and filtered data, you can either delay the raw data by the phase amount of the filter , or compensate the delay of the filter on the output signal (remove the first samples according to your filter response delay )
Matt Gaidica
on 6 Oct 2020
Mathieu NOE
on 6 Oct 2020
Matt
i am not 100% sure of what you intend to do , but if you want to smooth some noisy sine waves without adding delay , you should try to use bandpass filters and not only low pass filters.
If you know or measure first the sine wave frequency (f0) set the bandpass filter low and high pass frequency like this :
f_low = f0/a
f_high = f0*a
a defines the bandwith (selectivity) of you filter (start with a = 2 for example and see the diffeence when increasing / decreasing a)
the benefit of doing this way is that your bandpass filter will have zero delay at the f0 frequency, so if you implement it on a DSP , you can observe both raw and filtered signals without delay.
to furtehr comment on phase behaviour of filters, there is NO filter that has not a phase roll with frequency - even Bessel filters. This applies for analog and digital filters as well. Only if there is need for it , there are "linear" phase filters and "non linear" phase filters - but there is no "phase neutral" filter on earth - not sure what neutral means here...
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


