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

📄 crcgen1.m

📁 matlab编程及simulink实现的m_s文件程序
💻 M
字号:

function crc_data=crcgen1(data)
% k=4; % values of interest are 138, 113, 101, 87, 84, and 80
% data=randint(1,k,2)
poly=[ 1 1 1 0 1 ]; % x^4+x^3 + x^2 + 1
% poly = [1 1 1 0 1]; % x^4+x^3 + x^2 + 1
% Build the CRC with gfdeconv
[q,r]=gfdeconv(fliplr([data zeros(1,length(poly)-1)]),fliplr(poly));
r=fliplr(r); % change to descending powers
if length(r)<length(poly)-1
   r=[zeros(1,length(poly)-1-length(r)),r];
end
crc_data=[data r]; % add the remainder

⌨️ 快捷键说明

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