Skip to main content
Bumped by Community user
Bumped by Community user
added 749 characters in body
Source Link
user47976
user47976

I have made a blind DFE Equalization, I mean decision directed . But I am not sure how to make an implementation based on reference signalan implementation based on reference signal known by receiver and emitter.

  In the back forward filter adaptation how do I take this into consideration?

My second equation is to know if the updating rule for the RLS is the rigth one ?

clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq =comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1); hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR; end SNR=SNR (1:length(BER)); berTheory =

berawgn(SNR/log2(MQAM),'psk',2,'nondiff'); SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

    clearvars;
    close all; clc;
    MQAM = 2; 
    N = 1e2;
    L = 3;  
    LFF = 8;
    LFB = 8;
    target = 1e-6;
    error_min = 30;
    trans_min = 1e6;
    trans_max = error_min/target; 
    BER=0;
    SNR=0;
    iSNR=1;
    endSNR = 16;
    stepSNR = 2; 
    h = [1 0.5*exp(1i*pi/6)  0.1*exp(-1i*pi/8)]';
    eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ...
               "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ...
               'NumForwardTaps', LFF); eq.ReferenceTap = 1; 
    BER_mtlb = 0;
    handle = waitbar(0, 'Please wait...');

    p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);
 
    P2=(sigma^-1)*eye(LFB);
 
    while SNR(iSNR)<= endSNR            
         error_num=0;trans_num=0;  error_mtlb = 0; 
         while  (error_num <= error_min) && (trans_num <= trans_min) 
             MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
             hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;
     
             s = randi([0 1],N,1);
             smod = qammod(s,MQAM,'gray','InputType','bit'); 
             xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');
     
             out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
             smodCplx = complex(smod);
             [y, err, weigths] = eq(xin, smodCplx);
             rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
             error_mtlb = error_mtlb + sum( rxx ~= s);
             %- RLS DFE Equalization loop block 
             for n = 1: length(xin)
                 MemFF = [xin(n); MemFF(1:LFF-1)];
                 out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
                 sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
                 dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
                 
                 alpha(n) = dec(n) - out(n);% error of RLS
     
                 g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
                 P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 
     
                 g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
                 P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 
     
                 hFF = hFF  + alpha(n)*g1(:,n);
                 hFB = hFB + alpha(n)*g2(:,n);
                 MemBW = [dec(n); MemBW(1:LFB-1)];
 
             end
             
             M = min(length(s), length(sdec));
             Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
             [valMax,Delay] = max(abs(Ryx(M:M+99)));
             Delay = Delay-1;
     
             if (Ryx(M+Delay) < 0) 
                 sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
             end
             sdec_synchronized = sdec(1+Delay:end);
             s_synchronized = s(1:length(sdec_synchronized));
       
             error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
             trans_num = trans_num  + length(sdec_synchronized)  ;
         end % end this number of transmitted symbols
         
         BER(iSNR) = error_num/trans_num;
         BER_mtlb(iSNR) = error_mtlb/trans_num;
         waitbar(log10(BER(iSNR))/log10(target),handle);
         iSNR = iSNR+1;
        SNR(iSNR) = SNR(iSNR-1) + stepSNR;
 end
    SNR=SNR (1:length(BER)); berTheory =
    berawgn(SNR/log2(MQAM),'psk',2,'nondiff');  SNR =
    SNR(1:min(length(BER), length(BER_mtlb))); h = figure;
    semilogy(SNR,BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on;
    semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory');
    xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error');
    xlabel('SNR (dB)'); ylabel('BER'); grid on;
    XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])

I have made a blind DFE Equalization, I mean decision directed . But I am not sure how to make an implementation based on reference signal known by receiver and emitter.

  In the back forward filter adaptation how do I take this into consideration?

clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq =comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1); hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR; end SNR=SNR (1:length(BER)); berTheory =

berawgn(SNR/log2(MQAM),'psk',2,'nondiff'); SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

I have made a blind DFE Equalization, I mean decision directed . But I am not sure how to make an implementation based on reference signal known by receiver and emitter. In the back forward filter adaptation how do I take this into consideration?

My second equation is to know if the updating rule for the RLS is the rigth one ?

    clearvars;
    close all; clc;
    MQAM = 2; 
    N = 1e2;
    L = 3;  
    LFF = 8;
    LFB = 8;
    target = 1e-6;
    error_min = 30;
    trans_min = 1e6;
    trans_max = error_min/target; 
    BER=0;
    SNR=0;
    iSNR=1;
    endSNR = 16;
    stepSNR = 2; 
    h = [1 0.5*exp(1i*pi/6)  0.1*exp(-1i*pi/8)]';
    eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ...
               "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ...
               'NumForwardTaps', LFF); eq.ReferenceTap = 1; 
    BER_mtlb = 0;
    handle = waitbar(0, 'Please wait...');

    p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);
 
    P2=(sigma^-1)*eye(LFB);
 
    while SNR(iSNR)<= endSNR            
         error_num=0;trans_num=0;  error_mtlb = 0; 
         while  (error_num <= error_min) && (trans_num <= trans_min) 
             MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
             hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;
     
             s = randi([0 1],N,1);
             smod = qammod(s,MQAM,'gray','InputType','bit'); 
             xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');
     
             out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
             smodCplx = complex(smod);
             [y, err, weigths] = eq(xin, smodCplx);
             rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
             error_mtlb = error_mtlb + sum( rxx ~= s);
             %- RLS DFE Equalization loop block 
             for n = 1: length(xin)
                 MemFF = [xin(n); MemFF(1:LFF-1)];
                 out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
                 sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
                 dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
                 
                 alpha(n) = dec(n) - out(n);% error of RLS
     
                 g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
                 P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 
     
                 g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
                 P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 
     
                 hFF = hFF  + alpha(n)*g1(:,n);
                 hFB = hFB + alpha(n)*g2(:,n);
                 MemBW = [dec(n); MemBW(1:LFB-1)];
 
             end
             
             M = min(length(s), length(sdec));
             Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
             [valMax,Delay] = max(abs(Ryx(M:M+99)));
             Delay = Delay-1;
     
             if (Ryx(M+Delay) < 0) 
                 sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
             end
             sdec_synchronized = sdec(1+Delay:end);
             s_synchronized = s(1:length(sdec_synchronized));
       
             error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
             trans_num = trans_num  + length(sdec_synchronized)  ;
         end % end this number of transmitted symbols
         
         BER(iSNR) = error_num/trans_num;
         BER_mtlb(iSNR) = error_mtlb/trans_num;
         waitbar(log10(BER(iSNR))/log10(target),handle);
         iSNR = iSNR+1;
        SNR(iSNR) = SNR(iSNR-1) + stepSNR;
 end
    SNR=SNR (1:length(BER)); berTheory =
    berawgn(SNR/log2(MQAM),'psk',2,'nondiff');  SNR =
    SNR(1:min(length(BER), length(BER_mtlb))); h = figure;
    semilogy(SNR,BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on;
    semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory');
    xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error');
    xlabel('SNR (dB)'); ylabel('BER'); grid on;
    XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])
deleted 83 characters in body; added 161 characters in body
Source Link
user47976
user47976

`clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) % ||trans_num<=trans_max

    MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
    hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR;

end % end for Monte Carlo simulation for SNR range SNR=SNR (1:length(BER)); berTheory = berawgn(SNR/log2(MQAM),'psk',2,'nondiff');`

SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq =comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1); hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR; end SNR=SNR (1:length(BER)); berTheory =

berawgn(SNR/log2(MQAM),'psk',2,'nondiff'); SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

`clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) % ||trans_num<=trans_max

    MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
    hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR;

end % end for Monte Carlo simulation for SNR range SNR=SNR (1:length(BER)); berTheory = berawgn(SNR/log2(MQAM),'psk',2,'nondiff');

SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

`

clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq =comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1); hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR; end SNR=SNR (1:length(BER)); berTheory =

berawgn(SNR/log2(MQAM),'psk',2,'nondiff'); SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

added 3559 characters in body; deleted 78 characters in body
Source Link
user47976
user47976

Here is my rls tracking DFE matlab code

`clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) % ||trans_num<=trans_max

    MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
    hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR;

end % end for Monte Carlo simulation for SNR range SNR=SNR (1:length(BER)); berTheory = berawgn(SNR/log2(MQAM),'psk',2,'nondiff');

SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

Here is my rls tracking DFE matlab code

`clearvars; close all; clc; MQAM = 2; N = 1e2; L = 3; LFF = 8; LFB = 8;target = 1e-6; error_min = 30; trans_min = 1e6; trans_max = error_min/target; BER=0; SNR=0; iSNR=1; endSNR = 16; stepSNR = 2; h = [1 0.5exp(1ipi/6) 0.1exp(-1ipi/8)]'; eq = comm.DecisionFeedbackEqualizer('Algorithm', 'RLS', ... "AdaptAfterTraining",false, 'NumFeedbackTaps', LFB, ... 'NumForwardTaps', LFF); eq.ReferenceTap = 1;

BER_mtlb = 0;

handle = waitbar(0, 'Please wait...');

p=LFF; lamda=0.98; sigma=1; P1=(sigma^-1)*eye(LFF);

%p=LFF; P2=(sigma^-1)*eye(LFB);

while SNR(iSNR)<= endSNR
error_num=0;trans_num=0; error_mtlb = 0; while (error_num <= error_min) && (trans_num <= trans_min) % ||trans_num<=trans_max

    MemFF = zeros(LFF,1); MemBW = MemFF; hFF = zeros(LFF,1);
    hFB=hFF; hFF(ceil((LFF-1)/2)) = 1;

    s = randi([0 1],N,1); smod = qammod(s,MQAM,'gray','InputType','bit'); 
    xin = awgn(filter(h, 1, smod), SNR(iSNR), 'measured');

    out = zeros(N,1); dec = zeros(size(s)); sdec = zeros(size(s));
    smodCplx = complex(smod);
    [y, err, weigths] = eq(xin, smodCplx);
    rxx = qamdemod(y, MQAM, 'gray', 'OutputType', 'bit');
    error_mtlb = error_mtlb + sum( rxx ~= s);
    %- RLS DFE Equalization loop block 
    for n = 1: length(xin)
        MemFF = [xin(n); MemFF(1:LFF-1)];
        out(n) = transpose(hFF)*MemFF + transpose(hFB)*MemBW; 
        sdec(n) = qamdemod(out(n),MQAM,'gray','OutputType','bit');
        dec(n) = qammod(sdec(n),MQAM,'gray','InputType','bit');
        error = dec(n) - out(n);
        
        alpha(n) = dec(n) - out(n);% error of RLS

        g1(:,n)=P1*MemFF*((lamda + MemFF'*P1*MemFF).^-1); % Gain 
        P1=(lamda^-1)*P1 - g1(:,n)*MemFF'*(lamda^-1)*P1; 

        g2(:,n)=P2*MemBW*((lamda + MemBW'*P2*MemBW).^-1); % Gain 
        P2=(lamda^-1)*P2 - g2(:,n)*MemBW'*(lamda^-1)*P2; 

        
        hFF = hFF  + alpha(n)*g1(:,n);
        hFB = hFB + alpha(n)*g2(:,n);
        MemBW = [dec(n); MemBW(1:LFB-1)];

  
    end
    
    M = min(length(s), length(sdec));
    Ryx = xcorr(1-2*sdec(1:M),1-2*s(1:M),'unbiased');
    [valMax,Delay] = max(abs(Ryx(M:M+99)));
    Delay = Delay-1;

    if (Ryx(M+Delay) < 0) 
        sdec = qamdemod(-out,MQAM,'gray','OutputType','bit');
    end
    sdec_synchronized = sdec(1+Delay:end);
    s_synchronized = s(1:length(sdec_synchronized));
    
    error_num = sum(s_synchronized~= sdec_synchronized) + error_num;
    trans_num = trans_num  + length(sdec_synchronized)  ;
end % end this number of transmitted symbols

BER(iSNR) = error_num/trans_num;
BER_mtlb(iSNR) = error_mtlb/trans_num;
waitbar(log10(BER(iSNR))/log10(target),handle);
iSNR = iSNR+1; SNR(iSNR) = SNR(iSNR-1) + stepSNR;

end % end for Monte Carlo simulation for SNR range SNR=SNR (1:length(BER)); berTheory = berawgn(SNR/log2(MQAM),'psk',2,'nondiff');

SNR = SNR(1:min(length(BER), length(BER_mtlb))); h = figure; semilogy(SNR, BER, 'b--'); hold on; semilogy(SNR, BER_mtlb, 'g--'); hold on; semilogy(SNR, berTheory, 'kx-'); legend('Simulation DFE', 'Theory'); %xh=xlabel('E_b/N_0 (dB)'); %yh = ylabel('Probability of bit error'); xlabel('SNR (dB)'); ylabel('BER'); grid on; XMIN= 0; XMAX = 30; YMIN= 1e-7; YMAX= 1; axis([XMIN XMAX YMIN YMAX])`

edited tags; edited title
Link
user47976
user47976
Loading
Source Link
user47976
user47976
Loading