Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

短縮リード・ソロモン符号の送受信

RS 符号化し、64-QAM 変調した標準データと短縮データを AWGN チャネルを介して送受信します。標準符号と短縮符号の性能を比較します。

リード・ソロモン符号のパラメーターを設定します。ここで、N はコードワード長、K は公称メッセージ長、S は短縮メッセージ長です。変調次数 M を指定します。

N = 63;  % Codeword length
K = 51;  % Message length
S = 39;  % Shortened message length
M = 64;  % Modulation order

シミュレーション パラメーターを指定します。ここで、numErrors は Eb/No 点あたりの誤り数、numBits は Eb/No 点あたりの最大ビット数です。シミュレートする Eb/No 値の範囲を指定します。BER 配列を初期化します。

numErrors = 200;
numBits = 1e7;
ebnoVec = (8:13)';
[ber0,ber1] = deal(zeros(size(ebnoVec)));

エラー統計を収集するためのエラー レート オブジェクトを作成します。

errorRate = comm.ErrorRate;

RS(63,51) 符号のリード・ソロモン符号化器と復号化器のペアを作成します。符号化率を計算します。

rsEncoder = comm.RSEncoder(N,K,'BitInput',true);
rsDecoder = comm.RSDecoder(N,K,'BitInput',true);
rate = K/N;

主処理ループを実行します。

for k = 1:length(ebnoVec)
    
    % Convert the coded Eb/No to an SNR. Initialize the error statistics
    % vector.
    snrdB = ebnoVec(k) + 10*log10(rate) + 10*log10(log2(M));
    errorStats = zeros(3,1);
    
    while errorStats(2) < numErrors && errorStats(3) < numBits
        
        % Generate binary data.
        txData = randi([0 1],K*log2(M),1);
        
        % Encode the data.
        encData = rsEncoder(txData);
        
        % Apply 64-QAM modulation.
        txSig = qammod(encData,M, ...
            'UnitAveragePower',true,'InputType','bit');
        
        % Pass the signal through an AWGN channel.
        rxSig = awgn(txSig,snrdB);
        
        % Demodulated the noisy signal.
        demodSig = qamdemod(rxSig,M, ...
            'UnitAveragePower',true,'OutputType','bit');
        
        % Decode the data.
        rxData = rsDecoder(demodSig);
        
        % Compute the error statistics.
        errorStats = errorRate(txData,rxData);
    end
    
    % Save the BER data, and reset the errorRate counter.
    ber0(k) = errorStats(1);
    reset(errorRate)
end

RS(63,51) 符号のリード・ソロモン生成多項式を作成します。

gp = rsgenpoly(N,K,[],0);

短縮メッセージ長 S と生成多項式 gp を使用して、リード・ソロモン符号化器と復号化器のペアを作成します。短縮符号の符号化率を計算します。

rsEncoder = comm.RSEncoder(N,K,gp,S,'BitInput',true);
rsDecoder = comm.RSDecoder(N,K,gp,S,'BitInput',true);
rate = S/(N-(K-S));

短縮リード・ソロモン符号を使用して主処理ループを実行します。

for k = 1:length(ebnoVec)
    
    % Convert the coded Eb/No to an SNR. Initialize the error statistics
    % vector.
    snrdB = ebnoVec(k) + 10*log10(rate) + 10*log10(log2(M));
    errorStats = zeros(3,1);
    
    while errorStats(2) < numErrors && errorStats(3) < numBits
        
        % Generate binary data.
        txData = randi([0 1],S*log2(M),1);
        
        % Encode the data.
        encData = rsEncoder(txData);
        
        % Apply 64-QAM modulation.
        txSig = qammod(encData,M, ...
            'UnitAveragePower',true,'InputType','bit');
        
        % Pass the signal through an AWGN channel.
        rxSig = awgn(txSig,snrdB);
        
        % Demodulated the noisy signal.
        demodSig = qamdemod(rxSig,M, ...
            'UnitAveragePower',true,'OutputType','bit');
        
        % Decode the data.
        rxData = rsDecoder(demodSig);
        
        % Compute the error statistics.
        errorStats = errorRate(txData,rxData);
    end
    
    % Save the BER data, and reset the errorRate counter.
    ber1(k) = errorStats(1);
    reset(errorRate)
end

RS (63,51) 符号の近似 BER を計算します。

berapprox = bercoding(ebnoVec,'RS','hard',N,K,'qam',64);

RS(63,51) 符号と RS(51,39) 符号の BER 曲線を比較します。理論上の近似 BER 曲線をプロットします。符号の短縮が性能に影響を与えていないことを確認します。

semilogy(ebnoVec,ber0,'o-',ebnoVec,ber1,'c^-',ebnoVec,berapprox,'k--')
legend('RS(63,51)','RS(51,39)','Theory')
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
grid

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 RS(63,51), RS(51,39), Theory.