almostregularpermutation.m

来自「turbo 码matlab编译码程序」· M 代码 · 共 58 行

M
58
字号
function I=almostregularpermutation(K)
% c.berrou almost regular permutation
K=408;
P=43;
C=4;
B1=1;
B2=1;
B3=1;
for j=1:K
    if mod(j-1,C)==0
        Q=0;
        I(j)=mod(P*(j-1)+Q,K);
    elseif mod(j-1,C)==1
        Q=4*B1;
        I(j)=mod(P*(j-1)+Q,K);
    elseif mod(j-1,C)==2
        Q=4*P+4*B2;
        I(j)=mod(P*(j-1)+Q,K);
    elseif mod(j-1,C)==3
        Q=4*P+4*B3;
        I(j)=mod(P*(j-1)+Q,K);
    end
end
end

end
% flag=0;
% for j=1:K
%     for i=1:K
%         if I(j)==I(i)& j~=i
%             flag=flag+1;
%         end
%     end
% end

for j=1:K
  
    if mod(j-1,C)==0
        Q=0;
        E(j)=mod(P*(j-1)+Q,K);
    else if mod(j-1,C)==1
            Q=4*B1;
            F(j)=mod(P*(j-1)+Q,K);
        else  if mod(j-1,C)==2
                Q=4*P+4*B2;
                G(j)=mod(P*(j-1)+Q,K);
            else if mod(j-1,C)==3
                    Q=4*P+4*B3;
                    H(j)=mod(P*(j-1)+Q,K);
                end
            end
        end
    end
end

        
            

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?