前言
本文说明了如何为采用信道编码的通信链路设置Eb/N0(比特能量与噪声功率谱密度比)。
一、编码Eb/N0与未编码Eb/N0及编码码率
在通信系统仿真中,如果采用了FEC编码,则在设置AWGN信道Eb/N0时,需要考虑FEC编码码率R=K/N的影响。其中K为码字中信息码元的个数;N为码字的编码码元个数,也即信息码元数加校验码元数。
当通信链路中采用了信道编码, 编码的Eb/N0设置方法为:
CodedEbNo = UncodedEbNo + 10*log10(codeRate)
下面给出MATLAB仿真代码。
二、仿真代码
下面的MATLAB代码建立了一个“(15,9)RS码+8PSK”编码调制通信系统,显示了如何为采用信道编码的通信链路设置Eb/N0。
仿真中,通过设置不同的Eb/N0,绘制了系统的性能曲线。
N = 15; % R-S codeword length in symbols
K = 9; % R-S message length in symbols
num = 1e3; % R-S codeword number in symbols
M = 8; % Modulation order
% Construct a (15,9) Reed-Solomon encoder and a 8-PSK modulator.
rsEncoder = comm.RSEncoder('CodewordLength',N,'MessageLength',K,'BitInput',true);
pskModulator = comm.PSKModulator('ModulationOrder',M,'BitInput',true);
% Create the corresponding Reed-Solomon decoder and 8-PSK demodulator objects.
rsDecoder = comm.RSDecoder('CodewordLength',N,'MessageLength',K,'BitInput',true);
pskDemodulator = comm.PSKDemodulator('ModulationOrder',M,'BitOutput',true);
% Calculate the Reed-Solomon code rate based on the ratio of message symbols to the codeword length.
codeRate = K/N;
bitsPerSymbol = log2(M);
% Specify the uncoded Eb/No in dB. Convert the uncoded Eb/No to the corresponding coded Eb/No using the code rate.
UncodedEbNo = 0:2:16;
CodedEbNo = UncodedEbNo + 10*log10(codeRate);
% Construct an AWGN channel taking into account the number of bits per symbol. Set the EbNo property of channel to the coded Eb/No.
channel = comm.AWGNChannel('BitsPerSymbol',bitsPerSymbol);
% channel.EbNo = CodedEbNo;
% Set the total number of errors and bits for the simulation.
% For accuracy, the simulation should run until a sufficient number of bit errors are encountered.
% The number of total bits is used to ensure that the simulation does not run too long.
totalErrors = 100;
totalBits = 1e6;
% Construct an error rate calculator System object and initialize the error rate vector.
errorRate = comm.ErrorRate;
ber = zeros(length(UncodedEbNo),1);
for R = 1:length(UncodedEbNo)
reset(errorRate);
errorVec = zeros(3,1);
channel.EbNo = CodedEbNo(R);
% Run the simulation to determine the BER.
while errorVec(2) < totalErrors && errorVec(3) < totalBits
% Generate random bits
dataIn = randi([0,1],num*K,1);
% Use the RS (15,9) encoder to add error correction capability
dataEnc = rsEncoder(dataIn);
% Apply 8-PSK modulation
txSig = pskModulator(dataIn);
% Pass the modulated data through the AWGN channel
rxSig = channel(txSig);
% Demodulate the received signal
demodData = pskDemodulator(rxSig);
% Decode the demodulated data with the RS (15,9) decoder
dataOut = rsDecoder(demodData);
% Collect error statistics
errorVec = errorRate(dataIn,demodData);
end
% Display the resultant bit error rate.
ber(R) = errorVec(1);
end
figure()
semilogy(UncodedEbNo,ber,'ro-','LineWidth',1.5);
grid on;
xlabel('UncodedEbNo(dB)');
ylabel('BER');
title('8-PSK over AWGN Channels with RS Coding');
三、仿真结果
仿真结果如下: