I have two sine signals A and B which are simultaneously sampled at 2500 Hz using ADC. Through oscilloscope, I find that signal B lags A by about 5 degrees. I would like to digitally lead signal B to sync it with A. How to do that in MCU?
Do they lag 5 degrees for all frequencies? Or only for a specific signal frequency?
If you want to shift a signal by 5 degrees for all frequencies you need some kind of all-pass filter similar to a Hilbert filter. However the Hilbert Filter whether FIR or IIR shifts a signal by 90 degrees not 5.
However, if you want to add or subtract 5 degrees at a specific frequency, you need to this
delay = phase/( 2*pi * f).
If your delay is an integer number of samples, you simply need to delay your leading signal by this number of samples. However, if the delay is fractionnal you need to delay the leading signal with a fractional-delay filter.