RS編碼


RS 碼是一類糾錯能力很強的多進制BCH 碼,由於采用了q 進制,所以它是多進制調制時的自然和方便的編碼手段。因為RS 碼能夠糾正t 個q 位二進制碼,即 可以糾正≤q 位二進制錯誤(當然,對於 q 位二進制碼中分散的單個錯誤也能被糾正),所以適合於在衰落信道中使用,以 克服突發性差錯。另外RS 碼也被應用在計算機存儲系統中,以克服這系統中存在的差錯串。

RS編碼過程:

(1)得到RS碼的生成多項式g(x)
  (2)用信息碼多項式 m(x)除以生成多項式 g(x),所得余式 r(x)為監督碼多項式,將 監督碼多項式r(x)置於信息碼多項式之后,形成RS 碼。

GF(2m)域中計算,碼字長度:n=2m-1,糾錯能力:t=(n-k)/2

matlab相應函數:

1)rsgenpoly:

Generator polynomial of Reed-Solomon code

genpoly = rsgenpoly(n,k,prim_poly)

genpoly = rsgenpoly(n,k,prim_poly) returns the narrow-sense generator polynomial of a Reed-Solomon code with codeword length n and message length k. The codeword length n must have the form 2m-1 for some integer m, and n-k must be an even integer. The output genpoly is a Galois row vector that represents the coefficients of the generator polynomial in order of descending powers. The narrow-sense generator polynomial is (X - A1)(X - A2)...(X - A2t) where A is a root of the default primitive polynomial for the field GF(n+1) and t is the code's error-correction capability, (n-k)/2. prim_poly is an integer whose binary representation indicates the coefficients of the primitive polynomial. To use the default primitive polynomial GF(n+1), set prim_poly to [].If prim_poly specifies the primitive polynomial for GF(n+1) that has A as a root.

The examples below create Galois row vectors that represent generator polynomials for a [7,3] Reed-Solomon code. The vectors g and g2 both represent the narrow-sense generator polynomial, but with respect to different primitive elements A. More specifically, g2 is defined such that A is a root of the primitive polynomial D3 + D2 + 1 for GF(8), not of the default primitive polynomial D3 + D + 1. The vector g3 represents the generator polynomial (X - A3)(X - A4)(X - A5)(X - A6), where A is a root of D3 + D2 + 1 in GF(8).

2)primpoly

Finding Primitive Polynomials

You can use the primpoly function to find primitive polynomials for GF(2^m) and the isprimitive function to determine whether a polynomial is primitive for GF(2^m). The code below illustrates.

m = 4;

allprimpolys = primpoly(m,'all') % All primitive polys for GF(16)

i1 = isprimitive(25) % Can 25 be the prim_poly input in gf(...)?

function [alpha_to,index_of]=gen_galois()
clc
m=8;
n=2^m-1;
p=de2bi(285);
%p=[1 0 1 0 0 1];
alpha_to=zeros(1,2^m);
mask=1;
alpha_to(m+1)=0;
for i=1:m
alpha_to(i)=mask;
if(p(i)~=0)
 alpha_to(m+1)=bitxor(alpha_to(m+1),mask);
end
mask=mask*2;
end
mask=alpha_to(m);
for i=m+2:n
  if(alpha_to(i-1)>=mask)
  alpha_to(i)=bitxor(alpha_to(m+1),bitxor(alpha_to(i-1),mask)*2);
else
alpha_to(i)=alpha_to(i-1)*2;
end
end
alpha_to(2^m)=0;
 
index_of=zeros(1,2^m);
for i=1:2^m-1
  index_of(alpha_to(i))=i-1;
end
a=3;
b=27;
y=rs_mul(a,b,m,alpha_to,index_of)
ya=rs_add(a,b,m)
 
function y=rs_mul(a,b,m,alpha_to,index_of)
if a*b==0
   y=0;
else
   a1=index_of(a);
   b1=index_of(b);
   c=mod((a1+b1),(2^m-1));
   y=alpha_to(c+1);
end
 
 
function y=rs_add(a,b,m)
a1=de2bi(a,m);
b1=de2bi(b,m);
y1=bitxor(a1,b1);
y=bi2de(y1);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM