📄 lmseqdetecolor.m
字号:
%Zero Tap Detection LMS Equalizer with Colored Inputs%input generation and channel modelingu =[zeros(1,35),randn(1,5000)];H = [1,zeros(1,2),1,zeros(1,10),-2,zeros(1,10),3,zeros(1,10)];C=0.8;W=u;u=filter(1,[1,-C],W);u=sign(u);figure(1);plot(u);title ('Input u(k)');grid on;zoom on;xlabel('Number of Sample Intervals');ylabel('Sample Value');mu=0.005;N=length(W);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;%Channel EqualizationWV=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(2);plot (Q);title ('Equalizer');grid on;zoom on;xlabel('Number of Sample Intervals');ylabel('Squared Difference of u(k) and w(k)');%plot resultsfigure(3);plot (w);title ('Output w(k)');grid on;zoom on;xlabel('Number of Sample Intervals');ylabel('Sample Value');figure(4);subplot(2,1,1),plot(HH);title ('Adaptive Filter Output-Standard LMS Algorithm with Zero Tap Detection');xlabel('Number of Sample Intervals');ylabel('Tap Weight');grid on; zoom on;subplot(2,1,2),plot(sg);title('Sum of active taps-Standard LMS with Zero Tap Detection');xlabel('Number of Sample Intervals');ylabel('Number of Active Taps Detected');grid on;zoom on;figure(5);subplot(2,1,1),semilogy(He);title ('Adaptive Filter Output Asymptotic Error-Coloured Inputs');xlabel('Number of Sample Intervals');ylabel('Squared Euclidean Norm');grid on; zoom on;subplot(2,1,2),plot(sg);ylabel('Number of Active Taps Detected');xlabel('Number of Sample Intervals');grid on; zoom on;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -