Dft-Lms Filter
Dft-Lms Filter
Input:miu=stepsizeN=lengthofweighty_t=signal+noise(originallength)x_t=noise(originallength)r=forgettingratioP=
initialPower
a = length(x_t);
Blocks = a/N;
for k =1:Blocks - 1
%taking first N noise and fft
X = fft([x_t((k-1)*N + 1: (k+1)*N)],2*N);
x_estimate = ifft(X.*W);
%since FFT is symmetric only take last half
x_estimate = x_estimate(N+1:2*N,1);
%calculate weights!
E_error = fft([zeros(N,1);output(k*N+1:(k+1)*N)],2*N);
%estimate power
P = r*P+(1-r)*abs(X).^2;
Pinv = 1./P;
end
% make sure it is real
output=real(output(:));
end
PublishedwithMATLABR2017b