?? lmseqdetec.m
字號(hào):
%Detection Guided LMS Equalizer with White Inputs%Filename: Lmseqdetec.m%Noise variance of 0.01u =[zeros(1,35),randn(1,5000)];u=sign(u);figure(1);clf;plot(u);title ('Input');grid on;zoom on;H = [1,zeros(1,2),1,zeros(1,10),-2,zeros(1,10),3,zeros(1,10)];figure(2);clf;plot (H);title ('Channel Attenuation');grid on;zoom on;mu=0.005;N=length(u);n=length(H);He=zeros(1,N);nn=randn(1,N)*0.1;U=zeros(n,1);Channel=zeros(n,N);Est=zeros(n,N);shift=diag(ones(1,n-1),-1);HH=zeros(1,n);U=zeros(n,1);b=zeros(1,n);a=ones(1,n)*0.01;c=zeros(1,n);g=zeros(1,n);d=0;sg=zeros(1,N);for i=1:N, U=shift*U; U(1)=u(i); y(i)=H*U; v(i)=y(i)+nn(i); d=d+(v(i))^2; sigv=d/i; hv(i)=HH*U; e(i)=v(i)-hv(i); for k=1:n, if(k<i)&(i<=N) b(k)=b(k)+(v(i)*(u(i-k+1))); a(k)=a(k)+((u(i-k+1))^2); c(k)=((b(k))^2)/a(k); if c(k)>(sigv*log(i)) g(k)=1; else g(k)=0; end; sg(i)=sum(g); HH(k)=g(k)*HH(k)+g(k)*mu*(u(i-k+1))*e(i); end; end; He(i)=(H-HH)*(H-HH)'; Channel(:,i)= H'; Est(:,i) = HH';end;%%%%%%%%%%%%%%%%%%%%%%%%%WV=zeros(n,1);w=zeros(1,5035);for i=36:5035, WV=shift*WV; w(i)=sign([1/HH(1)]*[v(i)-(HH(2:36)*WV(2:36))]); Q(i)=(u(i)-w(i))^2; WV(1)=w(i);end;figure(3);clf;plot (Q);title ('Equalizer');grid on;zoom on;%%%%%%%%%%%%%%%%%%%%%%%%%%figure(4);clf;plot (w);title ('Output');grid on;zoom on;figure(7);clf;subplot(2,1,1),plot(HH);title ('Adaptive Filter Output-Standard LMS Algorithm with Zero Tap Detection');xlabel('Number of Iterations');ylabel('Tap Weight');grid on; zoom on;subplot(2,1,2),plot(sg);title('Sum of active taps-Standard LMS with Zero Tap Detection');grid on;zoom on;figure(8);clf;subplot(2,1,1),semilogy(He);title ('Adaptive Filter Output Asymptotic Error-Uncoloured Inputs');grid on; zoom on;subplot(2,1,2),plot(sg);ylabel('Number of Active Taps');grid on; zoom on;E=(H-HH).^2;figure(9);clf;plot(E);title('Square Error of Tap Weights between Channel and Equalizer');xlabel('Tap Number');ylabel('Square Error');grid on; zoom on;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -