RLS自适应均衡算法实例
<font face="Times New Roman">在LMS自适应均衡器算法的基础上,将其中的LMS的迭代过程换成了RLS算法,如果需要研究RLS自适应均衡器性能的影响参数的话,可以尝试调整均衡器系数和遗忘因子的大小。程序代码如下%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% RLS算法 实数基带系统仿真程序
% 功能:实数基带系统RLS均衡算法仿真-->BER\MSE指标
% 编写:李振兴
% E-Mail:lizhenxing@126.com
% Tel:
% 任何问题以及错误欢迎通过邮箱交流
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
close all hidden
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 初始化参数设置(用户可根据需要修改此处参数)
nFrame = 1; % 仿真发送的帧数(可作为蒙特卡洛仿真次数)
nPacket = 5000; % 每帧的发送的数据点数
step = 0.01; % 学习步长
dB = 25; % 信噪比
e = zeros(1,nPacket); % 瞬时计算误差
E = zeros(1,nPacket); % 统计均方误差(为平滑用)
h = ; %ISI信道参数
h = h/norm(h);
nW = 25; % 均衡器阶数
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 注意:当帧数nFrame不等于1的时候不要绘制星座图!
% nFrame根据需要可以适当设置,只要使得MSE曲线足够平滑就可以
% 均衡器阶数对结果影响较大,这里给出的是经过实验的最佳阶数
% 学习步长不宜设置过大
%% 算法实现过程
LP = nPacket-nW; % 移掉几个数据避免负或零下标
X = zeros(nW+1,LP); % 组织均衡器输入矩阵
% 循环开始(迭代次数=nFrame*nPacket)
for kk = 1:nFrame % 此处修改蒙特卡洛次数
W = zeros(nW+1,1);
sX = round(rand(1,nPacket))*2-1; % BPSK 或 2PAM 信号
% scatterplot(sX); % nFrame=1时调试用
rX = filter(h,1,sX); % 通过信道
% scatterplot(rX); % nFrame=1时调试用
vn = randn(1,nPacket); % 产生噪声数据
vn = vn/norm(vn)*10^(-dB/20)*norm(rX);% 根据信噪比调整噪声功率
SNR = 20*log10(norm(rX)/norm(vn)); % 计算SNR
rX = rX+vn; % 接收信号
XX = sign(rX);
= symerr(XX,sX) % 计算均衡前的误码
% scatterplot(rX); % nFrame=1时调试用
for i=1:LP
X(:,i)=rX(i+nW:-1:i).';
end
%% RLS 迭代算法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%初始化RLS相关参数%
lambda = 1.2; %遗忘因子
beta = std(rX)^2; %信号功率
P = 1/beta*eye(nW+1,nW+1);%初始化相关矩阵
% 开始均衡器参数调整
for i = 1:LP
K = (lambda^(-1)*P*X(:,i))/(1+lambda^(-1)*(X(:,i))'*P*X(:,i)); %计算增益矢量
e(i) = W'*X(:,i)-sX(i); %误差
W = W - conj(K)*e(i); %权值更新
P = lambda^(-1)*P-lambda^(-1)*K*(X(:,i))'*P; %相关矩阵更新
E(i) = E(i)+e(i)^2; %均方误差值
end
% 计算误码
rEx = W'*X; % 均衡后信号
% scatterplot(rEx) % nFrame=1时调试用
sDx = sign(rEx); % 判决信号
sErX = sDx-sX(1:length(sDx)); % 寻找误码
BER=length(find(sErX~=0))/length(sErX)
end
转自:http://blog.sina.com.cn/s/blog_5def5a660100d537.html
% 平滑误差
plot(10*log10(E))</font>
转自:http://blog.sina.com.cn/s/blog_5def5a660100d537.html
页:
[1]