Im writing an NLMS MATLAB program to remove powerline noise from ecg signals. I sweep through tap widths and learning rates which get the best SNR values.

Some of the combinations produce great SNRs but really attenuate the signal. For example, the figure below shows the noisey signal with the filtered signal (top) then the amplified filtered signal vs the noiseless signal

enter image description here

Signal filtering is not horrible but it really attenuates it! I can get ~30dB SNR (the image shows a 52dB SNR) with the sweep that has similar amplitudes as the original signal. I am wondering what in my algorithm Im doing is wrong. I am using the delayed signal+noise as the input into the filter and the signal+noise as the desired.

for i = M+1:N
    e = s(i) - w'*s(i-1:-1:i-M);
    den = s(i-1:-1:i-M)'*s(i-1:-1:i-M);
    w = w + mu*e*s(i-1:-1:i-M)/den;

WHen I include the normaliaztion term (ie x*x = den), it has no effect on the output. This normalization term should be a scalar, right? I am really at a loss for what I should change here and why the normalization term is not making a difference.



Why are you using the signal+noise as the desired? If the desired signal is just a time-delayed input signal, the adaptive filter will converge to a pure delay.

BTW, the first line in the loop should be e = d(i) - w'*s(i-1:-1:i-M); where $d(i)$ is the desired signal.

  • $\begingroup$ refer to this link. ocw.mit.edu/courses/mechanical-engineering/… there are many times where the LMS algorithm uses delayed signals in their implementation $\endgroup$
    – Paul Kumar
    Jul 20 at 11:27
  • $\begingroup$ @PaulKumar I see, you use the delayed signal as input so that it can’t be predicted. However using this structure to suppress narrow band noise has a assumption that the clean signal is wide-band and the ecg signals you presented doesn’t seem to be a wide band signal. Maybe you can try a narrow band ANC algorithm since the power line noise is mono-frequency. $\endgroup$
    – ZR Han
    Jul 20 at 12:07
  • $\begingroup$ Thank you sir! I will take a look $\endgroup$
    – Paul Kumar
    Jul 20 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.