【均衡器】LS均衡器,DEF均衡器以及LMMSE均衡器的误码率性能对比仿真

1.软件版本

matlab2017b

2.系统概述

clc;
clear all;      
close all;
warning off;
addpath 'func\'
rng(1)


N    = 300000;%指定信号序列长度?
info = func_random_binary(N);%产生二进制信号序列

SNR_in_dB=[7:1:14];%AWGN信道信噪比

 % SNR_in_dB=[12];%AWGN信道信噪比

for j=1:length(SNR_in_dB)
    j
    %通过既有码间干扰又有白噪声信道
    [y,len,h] = func_channel(info,SNR_in_dB(j));
    %初始误码统计数
    numoferr1=0;     
    %从第len个码元开始为真实信号码元 
    for i=len+1:N+len  
        decis = 2*[y(i)>=0]-1;      
        %判断是否误码,统计误码码元个数 
        if decis~=info(i-5)                          
           numoferr1=numoferr1+1;          
        end;     
    end;      
    %未经均衡器均衡,得到的误码率 
    Pe1(j)=numoferr1/N;   
    
    %LS均衡,参考文献
    %https://wenku.baidu.com/view/3fb6f52f195f312b3069a5a6.html
    Order = 5;
    z     = func_LS(y,info,Order);
    %初始误码统计数
    numoferr2=0;     
    %从第len个码元开始为真实信号码元 
    for i=1:N   
        decis(i) = 2*[z(i+Order)>=0]-1;      
        %判断是否误码,统计误码码元个数 
        if decis(i)~=info(i)                          
           numoferr2=numoferr2+1;          
        end;     
    end;      
    Pe2(j)=numoferr2/N;

    %DEF均衡
    z     = func_DEF(y(6:length(info)+5),info,h);
    decis = [2*[z>=0]-1]; 
    %初始误码统计数
    numoferr3=0;     
    %从第len个码元开始为真实信号码元 
    for i=1:N   
        if decis(i)~=info(i)                          
           numoferr3=numoferr3+1;          
        end;     
    end;      
    Pe3(j)=numoferr3/N;

    %LMMSE均衡
    z     = func_LMMSE(y,h,SNR_in_dB(j));
    decis = [2*[z>=0]-1]'; 
    %初始误码统计数
    numoferr4=0;     
    %从第len个码元开始为真实信号码元 
    for i=1:N-5    
        if decis(i+5)~=info(i)                          
           numoferr4=numoferr4+1;          
        end;     
    end;      
    Pe4(j)=numoferr4/N; 
end;  

figure;
semilogy(SNR_in_dB,Pe1,'red*-');
hold on; 
semilogy(SNR_in_dB,Pe2,'b-s');
hold on; 
semilogy(SNR_in_dB,Pe3,'k--','linewidth',2);
hold on; 
semilogy(SNR_in_dB,Pe4,'m->','linewidth',2);
grid on

 

legend('无均衡器','LS均衡器','DEF均衡器','LMMSE均衡器');
xlabel('SNR(dB)');
ylabel('error');

    
    
    
    
    
    
    
    
function y=func_LS(x,I,Order); 
%LS均衡,参考文献
%https://wenku.baidu.com/view/3fb6f52f195f312b3069a5a6.html
 
%根据LS方法计算权值w
r     = x;    % output of channel
n     = Order;    % rank of equalizer 均衡器的长度
delta = Order; % delay 信道延迟
p     = length(r)-delta;
A     = toeplitz(r(n+1:p),r(n+1:-1:1));
b     = I(n+1-delta:p-delta)';
w     = inv(A'*A)*A'*b;    %均衡器系数
y     = conv(w,r);

function s = func_DEF(x,info,H); 

M = length(x);
L = 27; 
a = 0.00005; 
d = 5; 
M2= M;
xf= x(1:M2);
for Iter=1:20; 
    s    = zeros(1,length(xf)); 
    y    = xf; 
    W1   = zeros(1,L); 
    W2   = zeros(1,d); 
    for m= d+L:1:M2 
        sum  = 0; 
        sum1 = 0; 
        sum2 = 0; 
        for n=m-1:-1:m-L 
            sum1=sum1+y(n)*W1(m-n); 
        end 
        for n=1:d 
            sum2=sum2+s(m-d-n)*W2(n); 
        end  
        e=info(m-d)-sum1+sum2; 
        for n=m-1:-1:m-L 
            W1(m-n)=W1(m-n)+2*a*e*y(n); 
        end 
        for n=1:d 
            W2(n)=W2(n)-2*a*e*s(m-d-n);  
        end 
        sum = sum1-sum2; 
        if sum >= 0 
           sum = 1; 
        else 
           sum =-1; 
        end 
        s(m-d)=sum; 
    end 
end 

for m= d+L:1:M2 
    sum  = 0; 
    sum1 = 0; 
    sum2 = 0; 
    for n=m-1:-1:m-L 
        sum1=sum1+y(n)*W1(m-n); 
    end 
    for n=1:d 
        sum2=sum2+s(m-d-n)*W2(n); 
    end  
    e=info(m-d)-sum1+sum2; 
    for n=m-1:-1:m-L 
        W1(m-n)=W1(m-n)+2*a*e*y(n); 
    end 
    for n=1:d 
        W2(n)=W2(n)-2*a*e*s(m-d-n);  
    end 
    sum = sum1-sum2; 
    if sum >= 0 
       sum = 1; 
    else 
       sum =-1; 
    end 
    s(m-d)=sum; 
end 

function y = func_LMMSE(x,h,SNR); 



N0    = 10^(-SNR/10);
sigma = sqrt(N0);  
Len   = 2500;
Lens  = floor(length(x)/Len);
Order = length(h);

y     = []; 
for j = 1:Lens
    Xtmp  = x((j-1)*Len+1:j*Len);
    H1 = zeros(Len,Len+Order-1);
    for k=1: Len
        H1(k,k:k+Order-1) = fliplr(h);   
    end
    H=H1(:,round(Order/2):Len+round(Order/2)-1);

    Xor      = xcorr(Xtmp,Xtmp)/Len;           
    Xor      = fliplr(Xor);
    L_Xtmp   = round(length(Xor)/2);
    C_yy     = zeros(L_Xtmp,L_Xtmp);
    for i=1:L_Xtmp;
        C_yy(i,:) = Xor(L_Xtmp+1-i:length(Xor)+1-i);
    end
    C_v     = sigma^2*eye(Len);
    C_xy    = H\(C_yy-C_v);
    E_yk    = sum(x)/Len*ones(1,Len);
    E_y     = H\E_yk';
    y_LMMSE = E_y + C_xy/C_yy*(Xtmp-E_yk)';
 
    y       = [y;y_LMMSE];
end

3.仿真结论

【均衡器】LS均衡器,DEF均衡器以及LMMSE均衡器的误码率性能对比仿真_第1张图片

4.参考文献

[1]聂晓鸿, 王建. 最小二乘法自适应均衡滤波研究[J]. 信息技术, 2013, 37(12):3.A01-139

你可能感兴趣的:(MATLAB,板块1:通信与信号处理,python,开发语言,LS均衡器,LMMSE均衡器,DEF均衡器)