リード・ソロモン符号​による誤り訂正のシミ​ュレーションをcom​m.RSEncode​rによって行う方法

2 ビュー (過去 30 日間)
akihisa oohori
akihisa oohori 2020 年 9 月 22 日
コメント済み: akihisa oohori 2020 年 9 月 23 日
リード・ソロモン符号化を使用した、ノイズを含むBPSKのBERを求めたいと考えております。そこで
を参考に、後述のコードによって計算を行いました。
すると、符号語長M=7, メッセージ長K=5など、小さな値では問題なく計算が行えましたが、これらの値を大きくすると(M=63, K=51など)、下記のようなエラーが発生し計算を行うことが出来なくなりました。
エラー: comm.RSEncoder/setupImpl (行 420)
The dimensions of the input X must be consistent with the BitInput property value, the message and codeword lengths, and the primitive polynomial. For more information, type 'help comm.RSEncoder/BitInput'.
エラー: RS_bpsk (行 24)
encData = rsEncoder(data);
解決方法がわかる方がいらっしゃいましたら、ご教示よろしくお願いいたします。
以下に使用したコードを載せさせていただきます。アドオンはCommunications Toolboxを使用しております。
clear
M = 2; % Modulation order
bps = log2(M); % Bits per symbol
N = 63; % RS codeword length
K = 51; % RS message length
data = randi([0 M-1],100,1); % Generate binary data
bpskModulator=comm.BPSKModulator; % Modulator
bpskModulator.PhaseOffset=pi/16; % Offset
bpskDemodulator=comm.BPSKDemodulator; % Demodulator
awgnChannel = comm.AWGNChannel('BitsPerSymbol',bps);
errorRate = comm.ErrorRate;
rsEncoder = comm.RSEncoder('BitInput',true,'CodewordLength',N,'MessageLength',K);
rsDecoder = comm.RSDecoder('BitInput',true,'CodewordLength',N,'MessageLength',K);
ebnoVec = (5:0.5:10)'; %Eb/N0の値の範囲設定
errorStats = zeros(length(ebnoVec),3); %誤り統計行列の初期化
for i = 1:length(ebnoVec)
awgnChannel.EbNo = ebnoVec(i);
reset(errorRate)
while errorStats(i,2) < 100 && errorStats(i,3) < 1e7
data = randi([0 1],1500,1); % Generate binary data
encData = rsEncoder(data); % RS encode
modData = bpskModulator(encData); % Modulate
rxSig = awgnChannel(modData); % Pass signal through AWGN
rxData =bpskDemodulator(rxSig); % Demodulate
decData = rsDecoder(rxData); % RS decode
errorStats(i,:) = errorRate(data,decData); % Collect error statistics
end
end
berNoCoding = berawgn(ebnoVec,'psk',8,'nondiff');
semilogy(ebnoVec,errorStats(:,1),'b*', ...
ebnoVec,errorStats(:,1),'c-',ebnoVec,berNoCoding,'r')
ylabel('BER')
xlabel('Eb/No (dB)')
legend('Data','Curve Fit','No Coding')
grid

採用された回答

takemoto
takemoto 2020 年 9 月 23 日
上記ドキュメントによれば、comm.RSEncoderの適用する生成多項式の次数Mは、
M = log2(語長+1)
となります。また、入力系列に関する条件として、'BitInput'プロパティをtrueとした場合、
入力ビット系列は、上記次数に相当するビット数に対応させるため、Mの倍数とする必要が
ありそうです。添付の例では、
M = lo2(65+1) = 6
となりますので、データ長1500の部分を、例えば、K*6とすることで、エラーは回避できそうですが、いかがでしょうか。
  1 件のコメント
akihisa oohori
akihisa oohori 2020 年 9 月 23 日
ご回答いただきありがとうございます、解決いたしました。

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchangeテストと計測 についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!