www.pudn.com > Normalized_LMS.zip > Normalized_LMS.m


  clear all; 
          snr=20; 
          order=8; 
          Hn =[0.8783   -0.5806    0.6537   -0.3223    0.6577   -0.0582   0.2895   -0.2710    0.1278   -0.1508    0.0238   -0.1814   0.2519   -0.0396    0.0423   -0.0152    0.1664   -0.0245   0.1463   -0.0770    0.1304   -0.0148    0.0054   -0.0381    0.0374   -0.0329    0.0313   -0.0253    0.0552  -0.0369   0.0479   -0.0073    0.0305   -0.0138    0.0152   -0.0012  0.0154   -0.0092    0.0177   -0.0161    0.0070   -0.0042  0.0051   -0.0131    0.0059   -0.0041    0.0077   -0.0034   0.0074   -0.0014    0.0025   -0.0056    0.0028   -0.0005   0.0033   -0.0000    0.0022   -0.0032    0.0012   -0.0020   0.0017   -0.0022    0.0004   -0.0011      0          0   ]; 
          Hn=Hn(1:order); 
          N=1000; 
%           r=wavread('C:\Matlab\work\Write_In_Paper\Shi_Yan.wav'); 
%           r=r(1:N);  
%           r=awgn(r,snr,'measured');  
          EE=zeros(N,1);   Loop=150;  mu=0.3; 
   for   nn=1:Loop 
          r=sign(rand(N,1)-0.5); % r=awgn(r,snr,'measured'); 
          output=conv(r,Hn);  
          output=awgn(output,snr,'measured'); 
          win=zeros(1,order);  
          error=zeros(1,N)'; 
   
     for i=order:N 
         input=r(i:-1:i-order+1);  
         e=output(i)-win*input; 
         win=win+mu*e*input'/(1+input'*input); 
         error(i)=error(i)+e^2; 
     end; 
     EE=EE+error; 
 end;   
            error=EE/Loop; 
      
             figure;   
             error=10*log10(error(order:N)); 
             plot(error,'r');  axis tight; grid on; 
%              semilogy(error(order:N),'b'); grid; axis  tight; 
%              subplot(212); 
%              plot(win,'r');  
%              hold on; plot(Hn,'b'); grid;  axis tight; 
 
 
 
 
 
 snr=20; 
          order=8; 
          Hn =[0.8783   -0.5806    0.6537   -0.3223    0.6577   -0.0582   0.2895   -0.2710    0.1278   -0.1508    0.0238   -0.1814   0.2519   -0.0396    0.0423   -0.0152    0.1664   -0.0245   0.1463   -0.0770    0.1304   -0.0148    0.0054   -0.0381    0.0374   -0.0329    0.0313   -0.0253    0.0552  -0.0369   0.0479   -0.0073    0.0305   -0.0138    0.0152   -0.0012  0.0154   -0.0092    0.0177   -0.0161    0.0070   -0.0042  0.0051   -0.0131    0.0059   -0.0041    0.0077   -0.0034   0.0074   -0.0014    0.0025   -0.0056    0.0028   -0.0005   0.0033   -0.0000    0.0022   -0.0032    0.0012   -0.0020   0.0017   -0.0022    0.0004   -0.0011      0          0   ]; 
          Hn=Hn(1:order); 
          N=1000; 
%           r=wavread('C:\Matlab\work\Write_In_Paper\Shi_Yan.wav'); 
%           r=r(1:N);  
%           r=awgn(r,snr,'measured');  
          EE=zeros(N,1);   Loop=150;  mu=0.01; 
   for   nn=1:Loop 
          r=sign(rand(N,1)-0.5); % r=awgn(r,snr,'measured'); 
          output=conv(r,Hn);  
          output=awgn(output,snr,'measured'); 
          win=zeros(1,order);  
          error=zeros(1,N)'; 
   
     for i=order:N 
         input=r(i:-1:i-order+1);  
         e=output(i)-win*input; 
         win=win+mu*e*input'; 
         error(i)=error(i)+e^2; 
     end; 
     EE=EE+error; 
 end;   
            error=EE/Loop; 
      
            hold on; 
             error=10*log10(error(order:N)); 
             plot(error);  axis tight; grid on; 
%              semilogy(error(order:N),'r'); grid; axis  tight; 
%              subplot(212); 
%              plot(win,'r');  
%              hold on; plot(Hn,'b'); grid;  axis tight;