Reply by el01...@mail.ntua.gr February 27, 20082008-02-27
Hi everyone,im doing a project regarding development of an adaptive
>notch filter to eliminate 50Hz noise from the biomedical signal.im a
>newbie to matlab so im sorry if there is any term that I
>misunderstood..correct me please..here i found one `lms adaptive
>notch filter' code from the post.i tried to run it..i felt like there
>is something wrong with the spectrum of initial signal(output).i can
>see there are few sharp(spikes).i don't really know how to say
>it..why it is like that?then i've tried with giving an ecg signal
>with 50hz noise and im getting an unexpected result like the filtered
>signal is worse than the initial signal..can anybody guide me
>please..awaiting for your reply..
>
>This is the code from the post:
>(one component at 200Hz, one at 280Hz, one at 60Hz plus white noise.
>In the sequel i design an lms adaptive filter which removes the 60Hz
>component from the initial signal.`from the author')
>
>clear all
>
>Fs = 1000;
>N = 1000;
>i = [0 : N-1]';
>
>%create the initial signal
>x = sin(2*pi*200* i/Fs) + 0.66*sin(2*pi* 280*i/Fs) + 0.59*sin(2*pi*
>60*i/Fs) + 0.5^0.5*randn( N,1);
>
>%create the reference signal of the adaptive filter
>u = sin(2*pi*60* i/Fs);
>
>%adaptive filter architecture
>L = 20;
>step_size = 0.005;
>w = zeros(1,L);
>
>%run the adaptive filter
>e(L) = x(L);
>for k = L : N
>regressor = flipud(u(k-L+ 1:k));
>w = w + step_size * regressor' * e(k);
>e(k+1) = x(k) - w * regressor;
>end
>
>%compute the spectrum of the initial signal and the filtered signal
>f = [0 : Fs/N : Fs - Fs/N]';
>F = abs(fft(x));
>E = abs(fft(e));
>
>%plot
>figure;
>subplot(411) ;plot(x); title('initial signal');
>subplot(412) ;plot(e); title('initial signal after filtering');
>subplot(413) ;plot(f,F( 1:length( f)));title( 'spectrum of initial
>signal');
>subplot(414) ;plot(f,E( 1:length( f)));title( 'spectrum of initial
>signal after filtering');
>
*************************************************************
hello,

i wrote this code.
if you want send to my mail your ECG signal and i will test it.

Manolis C. Tsakiris
>
Reply by ashwiny February 27, 20082008-02-27
Hi everyone,im doing a project regarding development of an adaptive
notch filter to eliminate 50Hz noise from the biomedical signal.im a
newbie to matlab so im sorry if there is any term that I
misunderstood..correct me please..here i found one `lms adaptive
notch filter' code from the post.i tried to run it..i felt like there
is something wrong with the spectrum of initial signal(output).i can
see there are few sharp(spikes).i don't really know how to say
it..why it is like that?then i've tried with giving an ecg signal
with 50hz noise and im getting an unexpected result like the filtered
signal is worse than the initial signal..can anybody guide me
please..awaiting for your reply..

This is the code from the post:
(one component at 200Hz, one at 280Hz, one at 60Hz plus white noise.
In the sequel i design an lms adaptive filter which removes the 60Hz
component from the initial signal.`from the author')

clear all

Fs = 1000;
N = 1000;
i = [0 : N-1]';

%create the initial signal
x = sin(2*pi*200* i/Fs) + 0.66*sin(2*pi* 280*i/Fs) + 0.59*sin(2*pi*
60*i/Fs) + 0.5^0.5*randn( N,1);

%create the reference signal of the adaptive filter
u = sin(2*pi*60* i/Fs);

%adaptive filter architecture
L = 20;
step_size = 0.005;
w = zeros(1,L);

%run the adaptive filter
e(L) = x(L);
for k = L : N
regressor = flipud(u(k-L+ 1:k));
w = w + step_size * regressor' * e(k);
e(k+1) = x(k) - w * regressor;
end

%compute the spectrum of the initial signal and the filtered signal
f = [0 : Fs/N : Fs - Fs/N]';
F = abs(fft(x));
E = abs(fft(e));

%plot
figure;
subplot(411) ;plot(x); title('initial signal');
subplot(412) ;plot(e); title('initial signal after filtering');
subplot(413) ;plot(f,F( 1:length( f)));title( 'spectrum of initial
signal');
subplot(414) ;plot(f,E( 1:length( f)));title( 'spectrum of initial
signal after filtering');