A multi-tap LMS adaptive noise canceller is simulated in MATLAB
first to illustrate the how it works and what achivable results
we will have for furthur implementation on FPGA. A simulated ECG
signal is defined the source, and a single sinusoid noise is used to
contaminate the signal. One portion of the MATLAB code is shown
below:
%MATLAB Warm Up
"ECG Noise Tracking"
close all
clear all
mu=0.8;
bhat(:,1)=transpose(zeros(1,140)); %number of weights
%creation of input vectors
load noise
itno=100000;
n=0.2*sin(100*(1:itno+length(bhat(:,1))-1));
s=sgolayfilt(ecg(itno+length(bhat(:,1))-1),0,15);
%simulation loop
%note that i+1 used as index for u at time i
for i=1:itno,
for j=1:length(bhat(:,1)),
W(j)=n(i+length(bhat(:,1))-j);
end
y=s(i);
yhat=W*bhat(:,i);
e(i)=y-yhat;
bhat(:,i+1)=bhat(:,i)+mu*e(i)*transpose(W);
end