Remove Filtered Signal Lag

533 views Asked by At

I have used MathDotNet library and implemented digital filtration on the input signal. I am getting 40 samples from my ADC and I am filtering each data sample as I get them. I have used FIR online filter and 2 median filter. enter image description here In the image there is a red line which is the raw signal and a blue line which is filtered signal. As seen there is a phase shift in my filtered signal. I want to remove it. Any ideas how to do it?

If you want to see my code in vb.net for some idea, then I can post it too.

1

There are 1 answers

0
SleuthEye On BEST ANSWER

If you are using a linear phase FIR filter with N coefficients operating on a signal sampled at a sampling frequency fs, the filter will introduce a delay of 0.5*(N-1)*fs (see for example dspGuru.com). This is perfectly normal.

To ease the comparison with the unfiltered signal, you may consider either:

  1. Delaying the unfiltered signal by the same amount; or
  2. Shifting back the filtered signal by the delay amount on the graph