LMS ALGORITHM to implement an adaptative filter

조회 수: 15 (최근 30일)
Sara
Sara 2011년 12월 13일
I should implement an LMS algorithm for a FIR adaptative filter, to filter the signal ecg where ecg is primary input and is =v+m where v is the desired signal not correlated with r (noise reference input of the filter) m is the noise of the signal ecg correlated with r the LMS algorithm is:
N=10; %orden del filtro
mu=0.4; %parameter
w=zeros(1,N+1); %vector of filter coefficients
e=zeros(1,slen); %vector of error defines as the difference between the desired signal and the input reference signal to compute the filter coefficients to iteratively minimize the error
y=zeros(slen,1);
r=sin(2*pi*60*t); %input reference signal=noise 60 Hz
for n=N+1:slen
in=r(n-N:n);
y(n)=w*in';
e(n)=ecg(n)-y(n);
w=w+2*mu*e(n)*in;
end
d=filter(w,1,ecg); %desidered output of the adaptative filter
figure(2); plot(t,d);
the problem is that the output is add much more noise to the original ecg filter, instead of reduce it.. Someone can explain me where is/are the error/s..? Thank you very much!

채택된 답변

Wayne King
Wayne King 2011년 12월 13일
What version of MATLAB are you using? Do you have the DSP System Toolbox, see the help adaptfilt.lms

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adaptive Filters에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by