⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fire_sys_coding.m

📁 GSM信道编码设计
💻 M
字号:
%fire_code
%g(x)=x^40+x^26+x^23+x^17+x^3+1=(x^23+1)(x^17+x^3+1)
%remark: not system code

%input:cc, the information bit-sequence whose length is 184
%output:uu, the fire code, bit-sequence whose length is 224

function uu=fire_sys_coding(cc)
% if the length of cc <184 then add 0
% if the length of cc >184 then remove the addition
% cc(x)=cc(1)*x^183+cc(2)*x^182+...+cc(183)*x+cc(184)
% uu(x)=cc(x)*g(x)=uu(1)*x^223+uu(2)*x^222+...+uu(223)*x+uu(224)

uu=zeros(1,224);


if(length(cc)<224)
   cc=[cc,zeros(1,224-length(cc))];
end

% information
for i=1:184,
   uu(i)=cc(i);
end

% check
cc(185:224)=1;

%generator vetrix
reg=zeros(1,40);
gg=zeros(1,41);
gg(41)=1;
gg(27)=1;
gg(24)=1;
gg(18)=1;
gg(4)=1;
gg(1)=1;

%division circuit
for i=1:184,
   tmp=rem((reg(40)+cc(i))*gg(41),2);%feedback
   for j=40:-1:2,
      reg(j)=rem(reg(j-1)+tmp*gg(j),2);
   end
   reg(1)=tmp;
end

for i=1:40,
   uu(184+i)=rem(reg(41-i)+1,2);
end

⌨️ 快捷键说明

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