均衡器模块:自适应滤波器部分
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
均衡器模块:自适应滤波器部分
一.工作原理
均衡器的工作原理:
在实际的通信系统中,有时不允许在传输信息前进行预置式调整,即使是可以采用这种预置式调整。但由于信道在传输期间变化的复杂性和随机性,实际中常采用自适应式均衡器,这种均衡器不再利用专门的单脉冲波形进行调整,他是在传输数据期间借助信号本身来自动均衡的。
由于是从时间响应考考虑设计的,故也称作时域均衡。这种技术就是在数字通信系统中插入一种可调滤波器可以校正和补偿系统特性,减少码间干扰的影响。这种起补偿作用的滤波器称为均衡器。从原理上讲,当信道特性已知时,均衡器的设计就是确定一组系数,使基带信号在采样时刻消除码间干扰。同时若信道的传输特性不时变,这组系数可以通过解一组线性方程或者用最优化求极值方法求得。但实际信道特性往往是不确定的或随时间变化的,特别是在移动状态下通信,所使用的信道及其传输特性每时每刻都在发生变化,且传输特性不理想。因此实际的传输系统要求均衡器能够通过对信道特性的测量随时调整自己的系数,以适应信道特性的变化。
最小均方畸变准则:设发送序列为{ ak} , ak 的取值是随机的, 包括均衡器在内的基带系统的输出样值序列为{ yk} , 以最小均方误差为准则时, 期望对于任意的k 有下述的均方误差最小:
式中,为均方误差的时间平均Ci的函数,最小, 表明均衡的效果最好。以
最小均方误差为准则时, 均衡器应调整他的各抽头系数, 使其满足:
其中:
由上式可知, 抽头增益的调整可以借助对误差ek 和样值x k- i 乘积的统计平均值。当误差信号ek 与均衡器输入样值x k- i ( i= ±1, ±2, ⋯, ±N) 互不相关时, 抽头系数
为最佳值。
二.编程,调试
1.系统原理框图:
算法流程图:
程序如下:
clear all
close all
%channel system order sysorder = 5 ;
% Number of system points N=2000;
inp = randn(N,1);
n = randn(N,1);
[b,a] = butter(2,0.25);
Gz = tf(b,a,-1);
%This function is submitted to make inverse Z-transform (Matlab central file exchange)
%The first sysorder weight value
%h=ldiv(b,a,sysorder)';
% if you use ldiv this will give h :filter weights to be
h= [0.0976;
0.2873;
0.3360;
0.2210;
0.0964;];
y = lsim(Gz,inp);
%add some noise
n = n * std(y)/(10*std(n));
d = y + n;
totallength=size(d,1);
%Take 60 points for training
N=60 ;
%begin of algorithm
w = zeros ( sysorder , 1 ) ;
for n = sysorder : N
u = inp(n:-1:n-sysorder+1) ;
y(n)= w' * u;
e(n) = d(n) - y(n) ;
% Start with big mu for speeding the convergence then slow down to reach the correct weights if n < 20
mu=0.32;
else
mu=0.15;
end
w = w + mu * u * e(n) ;
end
%check of results
for n = N+1 : totallength
u = inp(n:-1:n-sysorder+1) ;
y(n) = w' * u ;
e(n) = d(n) - y(n) ;
end
hold on
plot(d)
plot(y,'r');
title('System output') ;
xlabel('Samples')
ylabel('True and estimated output')
figure
semilogy((abs(e))) ;
title('Error curve') ;
xlabel('Samples')
ylabel('Error value')
figure
plot(h, 'k+')
hold on
plot(w, 'r*')
legend('Actual weights','Estimated weights')
title('Comparison of the actual weights and the estimated weights') ; axis([0 6 0.05 0.35])
% RLS 算法
randn('seed', 0) ;
rand('seed', 0) ;
NoOfData = 8000 ; % Set no of data points used for training Order = 32 ; % Set the adaptive filter order
Lambda = 0.98 ; % Set the forgetting factor
Delta = 0.001 ; % R initialized to Delta*I
x = randn(NoOfData, 1) ;% Input assumed to be white
h = rand(Order, 1) ; % System picked randomly
d = filter(h, 1, x) ; % Generat
e output (desired signal)
% Initialize RLS
P = Delta * eye ( Order, Order ) ;
w = zeros ( Order, 1 ) ;
% RLS Adaptation
for n = Order : NoOfData ;
u = x(n:-1:n-Order+1) ;
pi_ = u' * P ;
k = Lambda + pi_ * u ;
K = pi_'/k;
e(n) = d(n) - w' * u ;
w = w + K * e(n) ;