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

📄 crc_add.m

📁 已经通过编译~其中包括CRC基于Matlab的加法乘法编译以及仿真设计过程
💻 M
字号:
function [ output ] = crc_add( input, crc_no )%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  written by Wang Meifang on 24th April, 2008%   Email: mflltt@126.com%  the function is proposed for adding crc bits to the input sequence%  input:     the input information bits, a column vector%  crc_no:    the number of the adding crc bits, such as 3,8,12,16,24%  output:    the output information+crc bits, a column vector%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% the length of inputk = size(input,2); generator = zeros(1,crc_no+1);output = zeros(1,k+crc_no);switch  crc_nocase   3    generator = [1 0 1 1];case   8    generator = [1 1 0 0 1 1 0 1 1]; %D^8+D^7+D^4+D^3+D+1case   12    generator = [1 1 0 0 0 0 0 0 0 1 1 1 1]; %D^12+D^11+D^3+D^2+D+1case   16    generator = [1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1]; %D^16+D^12+D^5+1case   24    generator = [1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1]; %D^24+D^23+d^6+D^5+D+1otherwise    fprintf('\nPlease the number of crc bits should be 8 12 16 24\n');endoutput(1:k)=input;for ii = 1:k    if(output(1) == 1)        output(1:crc_no+1) = mod((output(1:crc_no+1)+generator),2);    end    output = [output(2:end) output(1)];endoutput = [input output(1:crc_no)];    

⌨️ 快捷键说明

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