tablecreat.m

来自「gsm的物理层仿真实现」· M 代码 · 共 37 行

M
37
字号
%****************************************************************
% 内容概述:creat new crc table 
% 创 建 人:李彩
% 单    位:Starpoint
% 创建时间:2008年
%参考TS 45.003
%****************************************************************
function output = tablecreat(crc)
switch(crc)
case 3,
    for i=0:255
        temp1 = crcbit(dectobit(i),3);
        temp2 = [0 0 0 0 0 temp1(9:11)];
        output(i+1) = bittodec(temp2);
    end
case 6,
    for i=0:255
        temp1 = crcbit(dectobit(i),6);
        temp2 = [0 0 temp1(9:14)];
        output(i+1) = bittodec(temp2);
    end
case 10,
    for i=0:255
        temp1 = crcbit(dectobit(i),10);
        temp2 = [0 0 0 0 0 0 temp1(9:18)];
        output(i+1) = bittohex(temp2);
    end
case 40,
    for i=0:255
        temp1 = crcbit(dectobit(i),40);
        temp = zeros(1,24);
        temp2 = [temp,temp1(9:48)];
        output(i+1) = bittodoubleword(temp2);
    end
otherwise,
    disp('CRC位数错误!请重新调用函数');
end

⌨️ 快捷键说明

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