⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 partb.m

📁 This is mat lab code for adaptive lattice filters.
💻 M
字号:

% Lattice filters in finite precision



clear all
close all

N = 500;
P = 200; % location of disturbance

SNR = 30;
var_v = 10^(-SNR/10);

M = 10; % filter oder
channel = randn(M,1);
channel = channel/norm(channel);

learn1 = zeros(1,N);
learn2 = zeros(1,N);
learn3 = zeros(1,N);
learn4 = zeros(1,N);
learn5 = zeros(1,N);
learn6 = zeros(1,N);

L = 50;

eta = 1e6;   % usually large
lambda = 0.999;

for j=1:L
   j
   input = randn(N,1);
   d = filter(channel,1,input) + sqrt(var_v)*randn(N,1);
    
   input(P) = input(P) + 1; % impulsive disturbance of unit magnitude at time P
   
   disp('a posteriori lattice')
   e1 = lat1(input,d,lambda,eta,M);    % a posteriori lattice

   disp('a priori lattice')
   e2 = lat2(input,d,lambda,eta,M);    % a priori lattice
   
   disp('a priori lattice with error feedback')
   e3 = lat3(input,d,lambda,eta,M);    % a priori with error feedback
   
   disp('a posteriori lattice with error feedback')
   e4 = lat4(input,d,lambda,eta,M);    % a posteriori with error feedback
   
   disp('normalized lattice')
   e5 = lat5(input,d,lambda,eta,M);    % normalized lattice
   
   disp('array lattice')
   e6 = lat6(input,d,lambda,eta,M);    % QR-based array lattice

   learn1 = learn1 + abs(e1).^2;
   learn2 = learn2 + abs(e2).^2;
   learn3 = learn3 + abs(e3).^2;
   learn4 = learn4 + abs(e4).^2;
   learn5 = learn5 + abs(e5).^2;
   learn6 = learn6 + abs(e6).^2;
   
 end

 learn1= 10*log10(learn1/L);
 learn2= 10*log10(learn2/L);
 learn3= 10*log10(learn3/L);
 learn4= 10*log10(learn4/L);
 learn5= 10*log10(learn5/L);
 learn6= 10*log10(learn6/L);

figure
subplot(321)
plot(1:N,learn1,'b');
ylabel('dB')
title('a-posteriori');
axis tight
grid

subplot(322)
plot(1:N,learn2,'b');
ylabel('dB')
title('a-priori');
axis tight
grid
 
subplot(323)
plot(1:N,learn3,'b');
ylabel('dB')
title('a-priori error feedback');
axis tight
grid

subplot(324)
plot(1:N,learn4,'b');
ylabel('dB')
title('a-posteriori error feedback');
axis tight
grid

subplot(325)
plot(1:N,learn5,'b');
ylabel('dB')
title('normalized');
axis tight
grid

subplot(326)
plot(1:N,learn6,'b');
ylabel('dB')
title('array');
axis tight
grid

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -