DFTLMSFilter
Input:miu=stepsizeN=lengthofweighty_t=signal+noise(originallength)x_t=noise(originallength)r=forgettingratioP=
initialPower
function output = dftLmsFilt(miu,N,y_t,x_t,r,P)
W = zeros(2*N,1);
output = y_t;
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);
%take first from N to N+K(lost first N)
y_N = y_t(k*N + 1: (k+1)*N);
%calculate error signal
output(k*N + 1: (k+1)*N,1)=y_N - x_estimate;
%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;
%estimate gradient(min of estimated noise)
E = ifft(Pinv.*conj(X).*E_error,2*N);
%take only first half
E = E(1:N);
%update the weights [E;zeroes(N,1)] because we take fft to put it
%to
W = W + miu*fft([E;zeros(N,1)],2*N);
end
% make sure it is real
output=real(output(:));
end
Not enough input arguments.
Error in dftLmsFilt (line 11)
W = zeros(2*N,1);
PublishedwithMATLABR2017b