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
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; end
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.