I'm trying to filter some motion noise from an ECG signal. To do that I'll try to implement an adaptive filter using the LMS algorithm.

I think I have to calculate the MSE of this:

E[e^2 ] = E[(s + n )^2 ]+ 2E[(s + n)X ]W^T + WE[X^T X ]W^T

in which s+n is the noised ECG,

X (n) = [ 1, Accx (n), Accy (n), Accz (n)] are the values from the accelerometer,

W = [w0, w1, w2, w3] the coefficients.

Wt +1 = Wt + 2αeX,

I'm trying to understand how to calculate alfa and minimise the MSE.


can anyone give me a simpler example? I'm kind of lost here.

  • 1
    $\begingroup$ I don't understand the relationship between s (your "noiseless" or "desired" ECG signal) and the accelerometer readings (X). Can you point to a model for the relationship? $\endgroup$ – Peter K. Jul 1 '13 at 19:19
  • $\begingroup$ @PeterK. I'm trying to remove motion noise from my ECG signal. $\endgroup$ – SamuelNLP Jul 1 '13 at 20:29

This scilab script implements a simple LMS adaptive filter.

M = 50;
LMS = zeros(M,N);
LMS(:,1) = zeros(M,1);
ERR = zeros(1,N);
y = zeros(1,N);
mu = 0.0005;

for t=M:N,
    Uwindowed = u(t - [0:M-1]');
    y(t) = LMS(:,t)'*Uwindowed.';
    ERR(t) = d(t) - y(t);
    LMS(:,t+1) = LMS(:,t) + mu*Uwindowed.'*ERR(t);

The inputs to it are u(t), the noisy signal and d(t) the desired signal. For the standard LMS algorithm to work, you need to have an idea of what the noiseless signal looks like.

From your equations:

  • $\alpha$ appears to be similar to mu (or mu/2).
  • u is your s+n.
  • I am not sure what your d is.
  • Your equation for the error is, er, erroneous. :-)
| improve this answer | |

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.