1
votes

I have to make a matlab program, which should create a QR Code.

My problem is the Reed Solomon error correction

The user enters the word he wants. [...] I got a string of numbers I should be gone in a polynomial generator (Reed Solomon) (I found some sites that do this very well: http://www.pclviewer.com/rs2/calculator.html)

I would like it to happen: for example I input: 32 91 11 120 209 114 220 77 67 64 236 17 236

[Reed Solomon generator polynomial]

and I want to find out: 168 72 22 82 217 54 156 0 46 15 180 122 16

I found the functions rsenc comm.rsencoder gf ... But it is impossible to understand the operation of these functions. Functions are detailed: http://www.mathworks.fr/fr/help/comm...n.html#fp12225

I tried a code of this type :

n = 255; k = 13; % Codeword length and message length
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(1,:)');
c = [c1].';

He produced a string of 255 while I want 13 output.

Thank you for your help.

1

1 Answers

0
votes

I think that you are committing a mistake.

'n' is the length of final message with parity code. 'k' is the lenght of message (number of symbols)

I guess that this will help you:

clc, clear all;
M = 16;     % Modulation Order || same that Max value, at your case: 256! 2^m
hEnc = comm.RSEncoder;
hEnc.CodewordLength = M - 1; % Max = M-1, Min = 4, Must be greater than MessageLenght
hEnc.MessageLength = 13;  % Experiment change up and down value (using odd number)
hEnc.BitInput = false;
hEnc
t = hEnc.CodewordLength - hEnc.MessageLength;
frame = 2*hEnc.MessageLength; % multiple of MensagemLength
fprintf('\tError Detection (in Symbols): %d\n',t);
fprintf('\tError Correction: %.2f\n',t/2);
data = randi([0 M-1], frame, 1); % Create a frame with symbols range (0 to M-1)
encodedData = step(hEnc, data);  % encod the frame