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

📄 addcrc.m

📁 小区初搜为GSM系统中的一个关键过程
💻 M
字号:
function output=addcrc(infor,g)
% infor is the input data.
% g is the coefficient array of ploy genarator
% output is the infor added crc codes
% infor = [ 0     0     1     0     1     1     0     0     0     1     1     0  ...
%     0       1    1     0     0     0     1     0     0     0     1     1     1 ];          % for 20070817_13  
%  infor = [  1     0     1     0     1     1     0     0     0     1     0     1 ...
%      1     0     1     0     1     0     0     0     0     0     1     0   0  ];          % for 22  
%   infor = [   1     0     1     0     1     1     0     0     1     0     0     1     0 ...
%      0     1     1     1     0     1     0     1     0     1     0     0    ];          %for  \20070824_35.
% %  infor = [ 1 0 1 1 0 0 1 0 1];
% 
%   infor = [   1     0     1     0     1     1     0     0     1     0     1     1     1 ...
%      0     1     1     0     1     0     0     0     0     1     1     0  ];          %for  \20070824_31.
%  
% g = [1 0 1 0 1 1 1 0 1 0 1];
% g = [1 0 0 1];

a=length(infor);
b=length(g);
x=[infor zeros(1,b-1)]; % add g '0s'to the infor
len=length(x);
for i=1:a
    if x(i)~=0
        x(i:(i+b-1))=xor(x(i:(i+b-1)),g);
    end
end
% output=[infor x((len):(-1):(len-b+2))];
output=[infor x((len-b+2):(len))];
% CRC = [x((len-b+2):(len))]
%  crcr =      [  0    1     0     1     1     1     0     1     1     0 ];    % for 20070817_13  
%  crcr =      [ 1   1     0     0     1     0     0     1     1     0 ];    %for  \20070824_35.
 
%  crcr =      [ 1    0     1     0     1     0     0     0     1     0 ];    %for  \20070824_31.
% 
% % crcr =      [  0     1     1     1     0     0     1     0     1     1 ];    % for 22
% %  crcr =      [    1     1     0     1     0     0     1     1     1     0 ];    % for 22
% xor( CRC,crcr)

⌨️ 快捷键说明

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