ankitchauhan said:hi chin...
i saw that u had a code for reed solomon in matlab with all the explanaton ...could you please forward it to me on ank_chauhan87(at)yahoo.co.in
thanks in advance
pshl said:If you are working with IEEE Std. 802.16-2004, then you might find the following useful which will work both in MATLAB if you have the Communications Toolbox or with Octave (which is available at www.octave.org).
Code:% Reed-Solomon coding based on the test vectors presented in % IEEE Std 802.16-2004 %% Input vector x and output vector z taken from Sect. 8.3.3.5.1, p444 x = ['D4';'BA';'A1';'12';'F2';'74';'96';'30'; ... '27';'D4';'88';'9C';'96';'E3';'A9';'52'; ... 'B3';'15';'AB';'FD';'92';'53';'07';'32'; ... 'C0';'62';'48';'F0';'19';'22';'E0';'91'; ... '62';'1A';'C1']; z = ['49';'31';'40';'BF';'D4';'BA';'A1';'12'; ... 'F2';'74';'96';'30';'27';'D4';'88';'9C'; ... '96';'E3';'A9';'52';'B3';'15';'AB';'FD'; ... '92';'53';'07';'32';'C0';'62';'48';'F0'; ... '19';'22';'E0';'91';'62';'1A';'C1';'00']; x = hex2dec(x)'; % This is the input data from the standard z = hex2dec(z)'; % This how the output data should be % Note that the parity bytes are first four bytes in the vector z, namely % '49';'31';'40';'BF' (hex). %% Define Reed-Solomon coding parameters m = 8; % Number of bits per symbol n = 2^m-1; % Length of encoded data (255 for m=8) k = 239; % Required length of source data (ie RS(255,239) ) t= (n-k)/2; %% Define the field generator primitive polynomial (D^8+D^4+D^3+D^2+1) % in decimal form according to eqn.(67), p432. p = 285; %% Form the msg vector from the input data. If the input data is shorter % than required, prefix it with zeros. Nzeros = k-length(x)-1; % Calculate how much zero padding to add. xk=[zeros(1,Nzeros) x 0]; % Make source data. Prefix with zero pads if needed. %% Creat Galois array from the source data msg=gf(xk, m, p); % Calculate the code generator polynomial according to eqn.(66) on p432 % of the standard (note that the 4th argument is 0 in the function call) % Expanding eqn.(66) gives the following polynomial coefficients: % 1 59 13 104 189 68 209 30 8 163 65 41 229 98 50 36 59 gen=rsgenpoly(n, k, p, 0); %% Encode the message code = rsenc(msg,n,k,gen); % Note that Octave does not appear to place the parity bytes where expected so some % sorting is required. code_new = [code(k+1:k+(t/2)) code(Nzeros+1:k)];
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?