m8ta
You are not authenticated, login. |
|
{585} | ||
LMS-based adaptive decorrelator, xn is the noise, xs is the signal, len is the length of the signal, delay is the delay beyond which the autocorrelation function of the signal is zero but the acf of the noise is non-zero. The filter is very simple, and should be easy to implement in a DSP. function [y,e,h] = lms_test(xn, xs, len, delay) h = zeros(len, 1); x = xn + xs; for k = 1:length(x)-len-delay y(k) = x(k+delay:k+len-1+delay) * h ; e(k) = x(k) - y(k); h = h + 0.0004 * e(k) * x(k+delay:k+len-1+delay)'; endIt works well if the noise source is predictable & stable: (black = sinusoidal noise, red = output, green = error in output) Now, what if the amplitude of the corrupting sinusoid changes (e.g. due to varying electrode properties during movement), and the changes per cycle are larger than the amplitude of the signal? The signal will be swamped! The solution to this is to adapt the decorrelating filter slowly, by adding an extra (multiplicative, nonlinear) gain term to track the error in terms of the absolute values of the signals (another nonlinearity). So, if the input signal is on average larger than the output, the gain goes up and vice-versa. See the code. function [y,e,h,g] = lms_test(xn, xs, len, delay) h = zeros(len, 1); x = xn + xs; gain = 1; e = zeros(size(x)); e2 = zeros(size(x)); for k = 1:length(x)-len-delay y(k) = x(k+delay:k+len-1+delay) * h; e(k) = (x(k) - y(k)); h = h + 0.0002 * e(k) * x(k+delay:k+len-1+delay)'; % slow adaptation. y2(k) = y(k) * gain; e2(k) = abs(x(k)) - abs(y2(k)); gain = gain + 1 * e2(k) ; gain = abs(gain); if (gain > 3) gain = 3; end g(k) = gain; end If, like me, you are interested in only the abstract features of the signal, and not an accurate reconstruction of the waveform, then the gain signal (g above) reflects the signal in question (once the predictive filter has adapted). In my experiments with a length 16 filter delayed 16 samples, extracting the gain signal and filtering out out-of-band information yielded about +45db improvement in SNR. This was with a signal 1/100th the size of the disturbing amplitude-modulated noise. This is about twice as good as the human ear/auditory system in my tests.
It doesn't look like much, but it is just perfect for EMG signals corrupted by time-varying 60hz noise. |