主要内容

估计硬决策和软决策 Viterbi 解码的 BER

估计 AWGN 中硬决策和软决策 Viterbi 解码器的误码率 (BER) 性能。将该性能与未编码的 64-QAM 链路进行比较。

设置仿真参数。

rng default
M = 64;                % Modulation order
k = log2(M);           % Bits per symbol
EbNoVec = (4:10)';     % Eb/No values (dB)
numSymPerFrame = 1000; % Number of QAM symbols per frame

初始化 BER 结果向量。

berEstSoft = zeros(size(EbNoVec)); 
berEstHard = zeros(size(EbNoVec));

为码率为 1/2、约束长度为 7 的卷积码设置网格结构和回溯深度。

trellis = poly2trellis(7,[171 133]);
tbl = 32;
rate = 1/2;

主处理循环执行以下步骤:

  • 生成二进制数据

  • 对数据进行卷积编码

  • 对数据符号应用 QAM 调制。指定发射信号的单位平均功率

  • 使调制信号通过 AWGN 信道

  • 使用硬决策和近似 LLR 方法解调接收信号。指定接收信号的单位平均功率

  • 使用硬决策和非量化方法对信号进行 Viterbi 解码

  • 计算误码数

while 循环继续处理数据,直到遇到 100 个误码或发射 107 个比特。

for n = 1:length(EbNoVec)
    % Convert Eb/No to SNR
    snrdB = EbNoVec(n) + 10*log10(k*rate);
    % Noise variance calculation for unity average signal power
    noiseVar = 10.^(-snrdB/10);
    % Reset the error and bit counters
    [numErrsSoft,numErrsHard,numBits] = deal(0);
    
    while numErrsSoft < 100 && numBits < 1e7
        % Generate binary data and convert to symbols
        dataIn = randi([0 1],numSymPerFrame*k,1);
        
        % Convolutionally encode the data
        dataEnc = convenc(dataIn,trellis);
        
        % QAM modulate
        txSig = qammod(dataEnc,M, ...
            InputType='bit', ...
            UnitAveragePower=true);
        
        % Pass through AWGN channel
        rxSig = awgn(txSig,snrdB,'measured');
        
        % Demodulate the noisy signal using hard decision (bit) and
        % soft decision (approximate LLR) approaches.
        rxDataHard = qamdemod(rxSig,M, ...
            OutputType='bit', ...
            UnitAveragePower=true);
        rxDataSoft = qamdemod(rxSig,M, ...
            OutputType='approxllr', ...
            UnitAveragePower=true, ...
            NoiseVariance=noiseVar);
        
        % Viterbi decode the demodulated data
        dataHard = vitdec(rxDataHard,trellis,tbl,'cont','hard');
        dataSoft = vitdec(rxDataSoft,trellis,tbl,'cont','unquant');
        
        % Calculate the number of bit errors in the frame. 
        % Adjust for the decoding delay, which is equal to 
        % the traceback depth.
        numErrsInFrameHard = ...
            biterr(dataIn(1:end-tbl),dataHard(tbl+1:end));
        numErrsInFrameSoft = ...
            biterr(dataIn(1:end-tbl),dataSoft(tbl+1:end));
        
        % Increment the error and bit counters
        numErrsHard = numErrsHard + numErrsInFrameHard;
        numErrsSoft = numErrsSoft + numErrsInFrameSoft;
        numBits = numBits + numSymPerFrame*k;

    end
    
    % Estimate the BER for both methods
    berEstSoft(n) = numErrsSoft/numBits;
    berEstHard(n) = numErrsHard/numBits;
end

绘制估计的硬决策和软决策 BER 数据。绘制未编码 64-QAM 信道的理论性能。

semilogy(EbNoVec,[berEstSoft berEstHard],'-*')
hold on
semilogy(EbNoVec,berawgn(EbNoVec,'qam',M))
legend('Soft','Hard','Uncoded','location','best')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')

Figure contains an axes object. The axes object with xlabel Eb/No (dB), ylabel Bit Error Rate contains 3 objects of type line. These objects represent Soft, Hard, Uncoded.

与预期相符,软决策解码产生最佳结果。