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

📄 commblkcrcgen2.m

📁 WCDMA model in symulink model in matlab
💻 M
字号:
function [genPolyDec, numBits, iniStatesDec, numChecksums] = ...    commblkcrcgen2(genPoly, iniStates, numChecksums)%COMMBLKCRCGEN2 Mask function for CRC generator and CRC% syndrome detector blocks for parameter checking.%   Copyright 1996-2001 The MathWorks, Inc.%   $Revision: 1.3 $  $Date: 2001/11/15 22:26:04 $% Check the Generator Polynomial parameterif ~(isvector(genPoly) | isscalar(genPoly))    error('The generator polynomial parameter must be a binary vector.');endif any(genPoly~=1 & genPoly~=0)    error('The generator polynomial parameter must be a binary vector.');endif ((genPoly(1) == 0) | (genPoly(end) == 0))    error('Invalid generator polynomial parameter values.');end% Check the Degree of polynomialnumBits = length(genPoly)-1;if numBits > 32    error('Only generator polynomials of degree 32 or less are allowed.');end% Convert to decimal valueif ( isscalar(genPoly) & (genPoly == 1) )    genPolyDec = 0;     % numBits = 0else     genPolyDec = bi2de(genPoly(2:end),'left-msb'); % without the leading implicit bitend% Check the Initial States parameterif ~(isvector(iniStates) | isscalar(iniStates))    error('The initial states parameter must be a scalar or a vector of size equal to the degree of the generator polynomial.');endif any(iniStates~=1 & iniStates~=0)    error('The initial states parameter values must be binary.');endif length(iniStates) == 1 % scalar expansion    iniStates = iniStates*ones(1,numBits);elseif length(iniStates) ~= numBits    error('The initial states parameter must be a scalar or a vector of size equal to the degree of the generator polynomial.');end% Convert to decimal valueif isempty(iniStates)    iniStatesDec = 0;     % numBits = 0else     iniStatesDec = bi2de(iniStates, 'left-msb');end% Check the number of Checksums parameterif ( isempty(numChecksums) | ~isreal(numChecksums) | isinf(numChecksums) | ...    (numChecksums <= 0) | (floor(numChecksums) ~= numChecksums) | ...    ~isscalar(numChecksums) )    error('The checksums per frame parameter must be an integer scalar greater than 0.');end% [EOF]

⌨️ 快捷键说明

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