How to generate error correction using Reed-Solomon Encoder?

I make QR code encoding which use Reed-Solomon encoding for error correction, I want to make 26 blocks codeword, contains 13 blocks message, and 13 blocks error correction. each block is decimal from 8 bit binary. I'm try using examples from help below:
n = 255; k = 13; % Codeword length and message length n=(2^m)-1
m = 8; % Number of bits in each symbol
msg = [32 91 11 120 209 114 220 77 67 64 236 17 236]; % Message is a Galois array.
obj = comm.RSEncoder(n, k);
c1 = step(obj, msg);
the output is 255 blocks, it can't be change value of n become 26;
then I try to using shortened message Reed solomon part III from help example below:
shortenLength = 229;
>> % Create a (63,53) RS encoder System object, and an RS decoder with an
>> % erasures input port, and two punctures.
>> N = 255; % Codeword length
>> K = 242; % Message length
>> numErasures = 8;
>> numPuncs = 2;
>> hEnc = comm.RSEncoder('BitInput', false);
hDec = comm.RSDecoder('BitInput', false, 'ErasuresInputPort', true);
hEnc.PuncturePatternSource = 'Property';
>> hEnc.PuncturePattern = [ones(N-K-numPuncs,1); zeros(numPuncs,1)];
>> hDec.PuncturePatternSource = 'Property';
>> hDec.PuncturePattern = hEnc.PuncturePattern;
>> % Set the shortened codeword length and message length values
>> hEnc.CodewordLength = N - shortenLength;
>> hEnc.MessageLength = K - shortenLength;
>> hDec.CodewordLength = N - shortenLength;
>> hDec.MessageLength = K - shortenLength;
>> hEnc.CodewordLength = N - shortenLength;
>> hEnc.CodewordLength
ans =
26
>> hEnc.PrimitivePolynomialSource = 'Property';
>> hEnc.PrimitivePolynomial = de2bi(primpoly(6, 'nodisplay'), 'left-msb');
hDec.PrimitivePolynomialSource = 'Property';
hDec.PrimitivePolynomial = de2bi(primpoly(6, 'nodisplay'), 'left-msb');
I got N and K value for 26 and 13 like I want, but I didn't get error correction from that function, anyone already using this Reed Solomon encoding?

댓글 수: 1

Vuxyom
Vuxyom 2013년 1월 10일
편집: Vuxyom 2013년 1월 10일
Hi I have exactly the same problem, if you find the solution can you tell me. Thank's

댓글을 달려면 로그인하십시오.

답변 (1개)

Thach Bui
Thach Bui 2018년 4월 3일
You should do some maths before programming. For example, the following code produces the message length of S in the field 2^7.
N = 127; % Codeword length
K = 5; % Message length
S = K; % shortened message length
m = log2(N + 1); % field GF(2^m)
%numErasures = 8;
numPuncs = N - K;
rsEncoder = comm.RSEncoder(N, K, 'BitInput', false);
rsEncoder.PuncturePatternSource = 'Property';
rsEncoder.PuncturePattern = [ones(N-K-numPuncs,1); zeros(numPuncs,1)];
% Set the shortened message length values
rsEncoder.ShortMessageLength = S;
% Specify the field of GF(2^6) in the RS encoder/decoder System objects, by setting the PrimitivePolynomialSource property ...
% to 'Property' and the PrimitivePolynomial property to a 6th degree primitive polynomial.
rsEncoder.PrimitivePolynomialSource = 'Property';
rsEncoder.PrimitivePolynomial = de2bi(primpoly(m, 'nodisplay'), 'left-msb');
%%Encoding process
% Data symbols - transmit 1 message word at a time, each message word has S symbols in the [0 2^P-1] range. P is the degree of the
% primitive polynomial specified in the RS encoder/decoder, which in this example equals 6.
data = randi([0 2^m-1], S, 1);
% Encode the shortened message word. The encoded word encData is N-numPuncs-K+S symbols long.
encData = step(rsEncoder, data);

카테고리

도움말 센터File Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

질문:

2012년 12월 11일

답변:

2018년 4월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by