A list,

Ii. Source code

C % The program to achieve the time domain LMS algorithm, and using statistical method simulation to get the convergence curve under the asynchronous length clear % clear the variable space close all g=100; % statistical simulation times are g N=1024; % input signal sampling points N k=128; % Time domain tap LMS algorithm filter order pp= Zeros (g, n-k); % Store the error results of each independent cycle in the matrix PP so that the average u=0.001; for q=1:g t=1:N; a=1; S = a * sin (0.05 * PI * t); % Input single frequency signal s figure(1); subplot(311) plot(t,real(s)); % signal s domain waveform title(' signal S domain waveform '); xlabel('n'); ylabel('s'); axis([0,N,-a-1,a+1]); xn=awgn(s,3); % Add gaussian white noise with mean of zero, SNR of 3dB % set initial value y= Zeros (1,N); % y y(1:k)=xn(1:k); % Take the first k values of input signal Xn as the first k values of output y w= Zeros (1,k); % Set tap weighting initial value e=zeros(1,N); % % error signal using LMS algorithm for iterative filtering I = (k + 1) : N XN = XN ((I - k + 1) : I); y(i)=w*XN'; e(i)=s(i)-y(i); w=w+u*e(i)*XN; end pp(q,:)=(e(k+1:N)).^2; end subplot(312) plot(t,real(xn)); % signal S time domain waveform plot(t,real(y)); % signal S time domain waveform title(' output time domain waveform after adaptive filtering '); for b=1:N-k bi(b)=sum(pp(:,b))/g; % Find the statistical average of the error endCopy the code

3. Operation results

Fourth, note

Complete code or simulation consultation QQ1575304183