%implements a frequency domain adaptive LMS filter, using the overlap save %method %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %restrictions: x & d = column vector function [y,e,w] = fdaf_lms(x,d,adapt) %get global variables global N;global mu;global W;global k;global g; %step that updates the output of the filter X = diag(fft(x)); Y = X*W;%W has to be a column vector y = k*ifft(Y)';y = y';%k has to be a row vector if (adapt == 1) %step that computes the future filtercoefficients e = d-y; E = fft([zeros(N);e]); grad = g*ifft(X'*E); W = W + 2*mu*eye(N)*fft(grad); end w = W