Estimate BER of QPSK in AWGN with Reed-Solomon (240,224) Coding

4 views (last 30 days)
I want to make a BER estimate of QPSK in AWGN with RS(240.224) as depicted in this paper. So I began with something working like the MATLAB example and I just made parameter changes as follows:
rng(1993); % Seed random number generator for repeatable results
M = 4; % Modulation order
bps = log2(M); % Bits per symbol
N = 240; % RS codeword length
K = 224; % RS message length
rsEncoder = comm.RSEncoder( ...
BitInput=true, ...
CodewordLength=N, ...
MessageLength=K);
rsDecoder = comm.RSDecoder( ...
BitInput=true, ...
CodewordLength=N, ...
MessageLength=K);
ebnoVec = (3:0.5:8)';
ebnoVecCodingGain = ...
ebnoVec + 10*log10(K/N); % Account for RS coding gain
errorStats = zeros(length(ebnoVec),3);
for i = 1:length(ebnoVec)
awgnChannel.EbNo = ebnoVecCodingGain(i);
reset(errorRate)
while errorStats(i,2) < 100 && errorStats(i,3) < 1e7
data = randi([0 1],1500,1);
encData = rsEncoder(data);
modData = pskmod(encData,M,InputType='bit');
rxSig = awgnChannel(modData);
rxData = pskdemod(rxSig,M,OutputType='bit');
decData = rsDecoder(rxData);
errorStats(i,:) = errorRate(data,decData);
end
end
Unrecognized function or variable 'errorRate'.
berCurveFit = berfit(ebnoVecCodingGain,errorStats(:,1));
semilogy(ebnoVecCodingGain,errorStats(:,1),'b*', ...
ebnoVecCodingGain,berCurveFit,'c-')
ylabel('BER')
xlabel('Eb/No (dB)')
legend('RS coded BER','Curve Fit')
grid
I keep getting this error:
Error using comm.RSEncoder/setupImpl
the dimensions of the Input X must be consistent with the BitInput property value, the message and Codeword lengths, and primitive polynomial. ...
Could someone help me please fixing this issue. Thank you

Accepted Answer

Balaji
Balaji on 22 Sep 2023
Hi Anour
I understand that you are facing an error in using the comm.RSEncoder.
When the ‘BitInput’ property is set to 1, the message length should be be an integer multiple of (MessageLength×M)  bits.
Where ‘MessageLength’ is ‘K’ and N = 2M -1. The current code doesn’t follow that property.
A group of M bits represents an integer in the range [0, (2M – 1)] that belongs to the finite Galois field gf(2M)
For more information on ‘comm.RSEncoderI suggest you refer to the following documentation:
Hope this helps
Thanks
Balaji

More Answers (0)

Community Treasure Hunt

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

Start Hunting!