I'm having some trouble implementing my LMS Adaptive Filter in MATLAB to separate wideband and narrowband signals from a voice signal.
I'm using a delayed version of my input as a reference as well as the error term.
step = 0.01;
w = zeros(1, N);
xDelayed = [zeros(1, 100) x']'; % delaying input
for n=1:length(x)
e = x(n) - w(1)*xDelayed(n);
w = w - step*e*xDelayed(n);
end
It's essentially an implementation of this
$$w(n+1) = w(n) - \alpha e(n) x(n)$$
For some reason, my entire w (N long) vector is all the same value. UPDATE:
M = 5;
N = length(sound)
w = zeros(M, N);
STEP_SIZE = 0.01;
d = sound;
x = sound_delayed(1:N);
for i=(M+1):N
e(i) = d(i) - x((i-(M)+1):i)*w(:,i);
w(:,i+1) = w(:,i) + mu * e(i) * x((i-(M)+1):i)';
end
for i=(M+1):N
yd(i) = x((i-(M)+1):i)*w(:,i);
end