資源簡介
rs碼編譯碼的matlab源代碼,譯碼使用bm算法,全是m文件,非simulink。

代碼片段和文件信息
%%%%%%%%%%%RS譯碼
function?m_xo=decoder(r_xnkmtm_xialpha_toindex_ofgx)
%?disp(‘伴隨多項式:‘)
%%%%%%%%%%%%%%%計算伴隨多項式S=H*R???????????calculate?the?syndrome?polynomial?accoding?to?the?received?sequence?‘r_x‘
%?all?calculations?are?in?the?GF(2^m)
%r_x=r_x(n:-1:1);
?s=zeros(1n-k);????%n-k個校正子(伴隨式)
for?j=1:n-k
???s(j)=rs_poly(r_xalpha_to(j+1)malpha_toindex_of);???%?use?the?function?rs_poly(tx)?to?calculate?s(j)=r(a^j)
end
synd_x=[1s]
synd_x
disp(‘錯誤位置多項式:‘)
%%%%%%%%%%%%%%%%%?用迭代算法?計算錯誤位置多項式??????這一步也是最復雜的一步,也是決定譯碼速度的主要因素。
sigma=zeros(n-k+2n-k+1);?%sigma矩陣用于記錄錯誤多項式?,最后一行為最終結果。
step=zeros(1n-k+2);?%step(i)表示第i次疊帶產生的錯誤位置多項式的階數
high=zeros(1n-k+2);?%high是第i+1次疊帶的最高項系數
sigma(11)=1;
step(1)=0;
high(1)=1;
sigma(21)=1;
step(2)=0;
high(2)=synd_x(2);
j_D=-1;
for?j=2:n-k+1
????
????if?(high(j)==0)
????????sigma(j+1:)=sigma(j:);
????????step(j+1)=step(j);
????else
????????for?h=1:j-1
????????????if(high(h)~=0)
????????????????if(h-high(h)>j_D)
????????????????????j_D=h-high(h);
?????????????????????
????????????????end
????????????????i=h;
????????????end;
????????end;
????????temp=zeros(1j-i+1);
????????temp(j-i+1)=1;?%a^(j-i)的多項式表示
????????temp1=rs_polymul(tempsigma(i:)malpha_toindex_of);?%多項式相乘。
????????len=length(temp1);
????????temp2=zeros(1n-k+1);
????????temp2=temp1(1:n-k+1);
???????%sigma(j+1:)=sigma(j:)+high(j)*rs_rev(high(i)malpha_toindex_of)*temp2;
???????%?sigma(j+1:)=bitxor(sigma(j:)high(j)*rs_rev(high(i)malpha_toindex_of)*temp2);
???????temp4=rs_mul(high(j)rs_rev(high(i)malpha_toindex_of)malpha_toindex_of);
????????for?l=1:n-k+1
????????????sigma(j+1l)=rs_add(sigma(jl)rs_mul(temp4temp2(l)malpha_toindex_of)m);
????????end;
???????
????end;
????????for?h=1:n-k+1
????????????if?(sigma(j+1h)~=0)
????????????????step(j+1)=h-1;
????????????end;
????????end;
????????for?h=1:step(j+1)
????????????temp3=rs_mul(sigma(j+1h+1)synd_x(j+1-h)malpha_toindex_of);
????????????high(j+1)=rs_add(high(j+1)temp3m);
????????end;
????????if(j+1 ????????high(j+1)=rs_add(high(j+1)synd_x(j+1)m);
????????end;
end;
sigma_x=sigma(n-k+2:);
sigma_x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
j=1;
root=[];
for?i=1:(2^m-1)
????result=rs_poly(sigma_xalpha_to(i)malpha_toindex_of);
????????if?result==0
????????????root(j)=alpha_to(i);
????????????j=j+1;
????????end
end
?root
site=[];
gf_site=[];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for?i=1:length(root)
???temp=rs_rev(root(i)malpha_toindex_of);???????%根的倒數即為錯誤位置?
???site(i)=index_of(temp);
end
%site
%?for?i=1:length(root)
%????gf_site(i)=alpha_to(site(i)+1);
%?end
%?gf_site
%%%%%%%%%%%第四步根據伴隨式,錯誤多項式及錯誤位置計算錯誤值,從而得到錯誤圖樣E
value=zeros(1t);?
w1=zeros(1length(synd_x)+length(sigma_x)-1);
%?‘t‘?is?the?max?number?of?errors
%?calculate?the?value?of?w(j)
for?i=1:length(synd_x)-1
????for?j=1:length(sigma_x)
????????w1
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3974??2009-05-06?19:15??rs54\decoder.asv
?????文件???????4017??2009-05-12?21:31??rs54\decoder.m
?????文件????????707??2009-05-06?19:15??rs54\encode.asv
?????文件????????708??2009-05-05?20:23??rs54\encode.m
?????文件???????4075??2009-05-04?15:19??rs54\rsencode54.asv
?????文件???????4075??2009-05-04?15:20??rs54\rsencode54.m
?????文件????????381??2008-11-17?15:31??rs54\rs_add.m
?????文件???????2753??2009-05-06?00:28??rs54\rs_main.asv
?????文件???????1395??2009-05-13?11:17??rs54\rs_main.m
?????文件????????694??2009-05-05?23:30??rs54\rs_mul.m
?????文件????????452??2009-05-06?16:25??rs54\rs_poly.asv
?????文件????????450??2009-05-11?21:08??rs54\rs_poly.m
?????文件????????365??2008-11-18?10:14??rs54\rs_polymul.m
?????文件????????600??2008-11-17?17:34??rs54\rs_rev.m
?????目錄??????????0??2010-03-18?00:55??rs54
-----------?---------??----------?-----??----
????????????????24646????????????????????15
評論
共有 條評論