Adjusting Reed-Solomon code

5 visualizzazioni (ultimi 30 giorni)
feras
feras il 16 Set 2023
Risposto: Prathamesh il 22 Set 2023
I want to adjust the parametres in the following Reed-Solomon code just to make the code work well with the size of encData equal to (1024*1). So may you help me to make size (encData)= 1024*1? (the code does not work here code run it with your Matlab program)
N = 63; % Codeword length
K = 51; % Message length
S = 39; % Shortened message length
M = 16; % Modulation order
numErrors = 200;
numBits = 1e7;
ebnoVec = (8:13)';
[ber0,ber1] = deal(zeros(size(ebnoVec)));
errorRate = comm.ErrorRate;
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
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 the primitive polynomial. For more information, type 'help comm.RSEncoder/BitInput'.

Risposte (1)

Prathamesh
Prathamesh il 22 Set 2023
Hi,
I understand that you are encountering the error when you are trying to adjust the parameters in the Reed-Solomon code.
The error is occurring because there is a mismatch between the dimensions of the input data and the requirements of the ‘comm.RSEncoder’ object. The ‘comm.RSEncoder’ expects the input data to have specific dimensions based on the ‘BitInput’ property, message length, codeword length, and primitive polynomial.
To resolve this issue, you can try to change the values of N, K, S, M in your code.
For example, I took these sample values respectively.
N = 130; % Codeword length
K = 100; % Message length
S = 70; % Shortened message length
M = 256; % Modulation order
The size of ‘encData’ obtained is equal to (1040*1).
You can try to tune these values in order to obtain the desired size of the ‘encData’.
Refer to the documentation of ‘comm.RSEncoder’ to get more information on how the values of N, K, S, M are to be selected.

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by