LMS ALGORITHM to implement an adaptative filter
4 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adaptive Filters 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!