You are on page 1of 1

RLSFilter

Input:lamda=forgettingfactorN=lengthofweight(filterorder)delta=initialvaluey_t=signal+noise(originallength)x_t=
noise(originallength)

function output = rlsFilt(lamda, N, delta, y_t, x_t)


w = zeros(N,1);
output = zeros(length(y_t),1);
x_N = zeros(N,1);
p = (1/delta).*eye(N);
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

a = y_t(k) - x_N' * w;
g = (p * x_N) / (lamda + x_N' * p * x_N);
p = (1 / lamda) * p - (1 / lamda) * g * x_N' * p;
w = w + a * g;
e = y_t(k) - x_N' * w;
output(k) = e;
end
end

Not enough input arguments.

Error in rlsFilt (line 10)


w = zeros(N,1);

PublishedwithMATLABR2017b

You might also like