1
$\begingroup$

I got a problem when I was trying to denoise a signal. Actually, it is a simple simulation. The signal is the addition of a step signal (The info I wish to get) and a sinusoidal one (the noise I wish to remove). See below(a) The noise (b) The signal and (c) Signal + the noise However, I tried different parameters of using the adaptive filter, it simply cannot filter out the sinusoidal noise from the step signal. See figure like this.Using adaptive filter

Any suggestions will be greatly appreciated!

Below is the matlab code

clear all
close all

%% walking induced noise
t = [1:5000]*1e-2;
f = 0.1;
WalkNoise = 1*sin(2*pi*f.*t);%+1.5*cos(3*pi*f.*t);
WN = WalkNoise + 0.05*randn(size(WalkNoise));

figure
subplot(3,1,1)
plot(t,WN);
title('Noise');

%% signal
h1 = 14; % height of the signal 1
h2 = 18; % height of the signal 2
L = 5000;  % total length of the signal
bp =2500;  % location of break point
x1 = h1*ones(1,bp);
x2 = h2*ones(1,L-bp);
Sig = [x1,x2];
Sig = Sig + 0.1*randn(size(Sig));

subplot(3,1,2)
plot(t,Sig);
title('Signal');

%% walking-induced-noise + signal
NoisySig = Sig + WN;
subplot(3,1,3)
plot(t,NoisySig); hold on
title('Signal + noise');

%% adaptive filtering
figure
plot(t,NoisySig); hold on
title('Signal + noise');

mu = 0.001;            % LMS step size.
ha = adaptfilt.lms(20,mu);
[y,e] = filter(ha,WN,NoisySig);
plot(t,e,'r');
legend('Signal+noise','Filtered using Adaptive filter');
$\endgroup$
  • $\begingroup$ Adaptive filters are used to find s certain state/velocity/acceleration or mapping of such signals - you may refer to them as trackers. In your case you just need to use a simple band pass to filter out the sinusoid. $\endgroup$ – Moti May 7 '15 at 7:00
  • $\begingroup$ You are plotting the error output of the filter (e). What do you get if you plot the output of the filter (y?) I'd try it myself, but Octave doesn't seem to have function matching the Matlab adaptfilt.lms $\endgroup$ – JRE May 7 '15 at 9:14
  • $\begingroup$ Dear Moti: The reason why I prefer adaptive filter it is because noise can change its frequency distribution, although in this case it is fixed. Thanks for the kind help! $\endgroup$ – Xuefeng Liu May 8 '15 at 4:55
  • $\begingroup$ Dear JRE: I may not fully understand your question. Here I wish to use the adaptive filter to remove the noise. So one input of the adaptive filter will be the signal+noise (NoisySig), and another input would be the measured noise. The output of the Adaptive filter is the noise which tries to mimic the real noise. So it is e that I wish to have (e represent the final signal I wish to obtain). $\endgroup$ – Xuefeng Liu May 8 '15 at 4:59
1
$\begingroup$

I tried your code change adaptfilt.lms to adaptfilt.nlms
also decrease the step size to 0.0001
These conditions gave me better results.
nlms is better than lms as there is stability in learning filter coefficeints.The lms algorithm could change the filter coefficients drastically.

$\endgroup$
  • $\begingroup$ Dear Vinith: Thanks so much for the help. I guess the result now is satisfactory. $\endgroup$ – Xuefeng Liu May 8 '15 at 4:53

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.