📄 rsdecodeiterate.m
字号:
%*************************************************************************
% Copyright (C) 2008 Circuit and System Lab of PKU
%
% Created : 2008-5
% Author : houdong(houdong@pku.edu.cn)
%
% File Name : RsDecodeIterate.m
%
% Abstract : Calculating the error locator polynomial
%
% Version : 1.0 2008-5 All Right Reserved.
%*************************************************************************
function [ErrorPosPolyCalc,SigmaCalc]=RsDecodeIterate(SyndromCalc)
%sigma(i:)是第i次叠带产生的错误位置多项式,step(i)表示第i次叠带产生的错误位置多项式的阶数,high是pi(x)第i+1次叠带的最高项系数
sigma=zeros(6,5);
step=zeros(1,6);
high=zeros(1,6);
sigma(1,1)=1;
step(1)=0;
high(1)=1;
sigma(2,1)=1;
step(2)=0;
high(2)=SyndromCalc(1);
% Massey Algorithm
for j=2:5
if (high(j)==0)
sigma(j+1,:)=sigma(j,:);
step(j+1)=step(j);
else
for n=1:j-1
if(high(n)~=0)
i=n;
end;
end;
temp=zeros(1,j-i+1);
temp(j-i+1)=1;
temp1=RsPolyMul(temp,sigma(i,:));
len=length(temp1);
temp2=zeros(1,5);
temp2=temp1(1:5);
sigma(j+1,:)=sigma(j,:)+high(j)*RsSymbolRev(high(i))*temp2;
temp4=RsSymbolMul(high(j),RsSymbolRev(high(i)));
for l=1:5
sigma(j+1,l)=RsSymbolAdd(sigma(j,l),RsSymbolMul(temp4,temp2(l)));
end;
end;
for m=1:5
if (sigma(j+1,m)~=0)
step(j+1)=m-1;
end;
end;
for t=1:step(j+1)
temp3=RsSymbolMul(sigma(j+1,t+1),SyndromCalc(j-t));
high(j+1)=RsSymbolAdd(high(j+1),temp3);
end;
if(j<5)
high(j+1)=RsSymbolAdd(high(j+1),SyndromCalc(j));
end;
end;
SigmaCalc=sigma;
ErrorPosPolyCalc=sigma(6,:);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -