大家好,欢迎来到IT知识分享网。
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);
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/30836.html