You are on page 1of 1

LMSFilter

Inputmu=stepsizeN=lengthofweighty_t=signal+noise(originallength)x_t=noise(originallength)

function output = lmsFilt(mu,N,y_t,x_t)


w = zeros(N,1);
output = zeros(length(y_t),1);
x_N = zeros(N,1);
for k =1:length(y_t)
if(k<N)
x_N(1:k,1) = flipud(x_t(1:k));
else
x_N = x_t((k-(N-1)):k,1);
x_N = flipud(x_N);
end

e = y_t(k) - w' * x_N;


w = w + 2 * mu * e * x_N;
output(k,1)= e;
end
end

Not enough input arguments.

Error in lmsFilt (line 9)


w = zeros(N,1);

PublishedwithMATLABR2017b

You might also like