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).