英语培训网站源码,注册公司网上申请入口,网站怎么做友链,app注册推广定义CRC生成和检验的类#xff08;包括函数#xff09;
我们在MATLAB中定义一个类#xff08;class#xff09;#xff0c;包含了CRC生成函数和检验函数#xff08;囊括了常用的CRC多项式#xff09;
classdef CRCpropertiesCRCbit_LenpolynomialCRCgenCRCdetendmetho…定义CRC生成和检验的类包括函数
我们在MATLAB中定义一个类class包含了CRC生成函数和检验函数囊括了常用的CRC多项式
classdef CRCpropertiesCRCbit_LenpolynomialCRCgenCRCdetendmethodsfunction obj CRC(CRCbit_Len) %(polynomial)obj.CRCbit_Len CRCbit_Len;switch CRCbit_Lencase 0obj.polynomial [0];case 1obj.polynomial [1 1];case 2obj.polynomial [1 1 1];case 3obj.polynomial [1 1 1 1];case 4obj.polynomial [1 0 0 1 1]; % x^4 x 1case 5obj.polynomial [1 0 0 1 0 1];case 6obj.polynomial [1 0 0 0 0 1 1]; %1000001case 7obj.polynomial [1 0 0 0 1 1 1 1];case 8obj.polynomial [1 0 0 1 1 0 0 0 1];case 9obj.polynomial [1 0 0 0 1 0 0 0 0 1];case 10obj.polynomial [1 0 0 0 0 1 0 0 0 1 1];case 11obj.polynomial [1 0 0 0 0 0 0 1 0 0 0 1];case 12obj.polynomial [1 0 0 1 0 0 0 0 0 0 0 1 1];case 13obj.polynomial [1 0 0 0 1 0 0 0 0 0 0 0 1 1]; case 14obj.polynomial [1 0 0 0 0 1 0 1 0 0 0 0 0 1 1];case 15obj.polynomial [1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1];case 16obj.polynomial [1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1];case 24obj.polynomial [1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1];otherwisedisp([Please add the corresponding polynomial in binary form.]);endobj.CRCgen crc.generator(Polynomial, obj.polynomial, ...InitialState, zeros(1, obj.CRCbit_Len), ...FinalXOR, zeros(1, obj.CRCbit_Len));obj.CRCdet crc.detector(Polynomial, obj.polynomial, ...InitialState, zeros(1, obj.CRCbit_Len), ...FinalXOR, zeros(1, obj.CRCbit_Len));end% generate CRCfunction crcencoded_data encode(obj, data)crcencoded_data generate(obj.CRCgen, data); % SourceCoding_Len x No_Active_Usersend% detect CRCfunction [crcdecoded_data, error_detected] decode(obj, received_data)[crcdecoded_data, error_detected] detect(obj.CRCdet, received_data); endend
end程序示例包含交织和解交织功能
clc; clear all;
rng(default);
warning(off);K0 12; % information bits
K_crc 4; % crc bits length
N 16; % coded length (omit here)
% Rate (K0 K_crc) / N;Ka 10; % packet number% Preporcessing:
% interleaver and de-interleaver related: for row vector
interleaver_IDs randperm(N);
[~, de_interleaver_IDs] sort(interleaver_IDs);
interlv_func (Bits) Bits(:, interleaver_IDs); % Bits could be a matrix with size (packet_num x FEC_Len)
de_interlv_func (interlv_Bits) interlv_Bits(:, de_interleaver_IDs);% invoke CRC class
CRC CRC(K_crc);% Transmission
% information bits
u0 randi([0, 1], K0, Ka);
% append CRC
u CRC.encode(u0); % (K0 K_crc) x Ka
% interleaving
inlv_bits interlv_func(encodedBits);% omit encoding process and receiver procedure% de-interleaving
deinlv_bits de_interlv_func(inlv_bits );
文章转载自: http://www.morning.rqqlp.cn.gov.cn.rqqlp.cn http://www.morning.skpdg.cn.gov.cn.skpdg.cn http://www.morning.c7501.cn.gov.cn.c7501.cn http://www.morning.gqtw.cn.gov.cn.gqtw.cn http://www.morning.chmkt.cn.gov.cn.chmkt.cn http://www.morning.fwrr.cn.gov.cn.fwrr.cn http://www.morning.wptdg.cn.gov.cn.wptdg.cn http://www.morning.mfmrg.cn.gov.cn.mfmrg.cn http://www.morning.nmtyx.cn.gov.cn.nmtyx.cn http://www.morning.qtqk.cn.gov.cn.qtqk.cn http://www.morning.ptysj.cn.gov.cn.ptysj.cn http://www.morning.lfpzs.cn.gov.cn.lfpzs.cn http://www.morning.lysrt.cn.gov.cn.lysrt.cn http://www.morning.yckrm.cn.gov.cn.yckrm.cn http://www.morning.spxk.cn.gov.cn.spxk.cn http://www.morning.jxmjr.cn.gov.cn.jxmjr.cn http://www.morning.splcc.cn.gov.cn.splcc.cn http://www.morning.mzpd.cn.gov.cn.mzpd.cn http://www.morning.kqhlm.cn.gov.cn.kqhlm.cn http://www.morning.qieistand.com.gov.cn.qieistand.com http://www.morning.txqsm.cn.gov.cn.txqsm.cn http://www.morning.gccdr.cn.gov.cn.gccdr.cn http://www.morning.fpngg.cn.gov.cn.fpngg.cn http://www.morning.khntd.cn.gov.cn.khntd.cn http://www.morning.kgcss.cn.gov.cn.kgcss.cn http://www.morning.fpzz1.cn.gov.cn.fpzz1.cn http://www.morning.fdfdz.cn.gov.cn.fdfdz.cn http://www.morning.jfxth.cn.gov.cn.jfxth.cn http://www.morning.china-cj.com.gov.cn.china-cj.com http://www.morning.gcspr.cn.gov.cn.gcspr.cn http://www.morning.ympcj.cn.gov.cn.ympcj.cn http://www.morning.phjny.cn.gov.cn.phjny.cn http://www.morning.mytmx.cn.gov.cn.mytmx.cn http://www.morning.glcgy.cn.gov.cn.glcgy.cn http://www.morning.xnhnl.cn.gov.cn.xnhnl.cn http://www.morning.zwgrf.cn.gov.cn.zwgrf.cn http://www.morning.kfwrq.cn.gov.cn.kfwrq.cn http://www.morning.lgkbn.cn.gov.cn.lgkbn.cn http://www.morning.fgxr.cn.gov.cn.fgxr.cn http://www.morning.jlpdc.cn.gov.cn.jlpdc.cn http://www.morning.wqrk.cn.gov.cn.wqrk.cn http://www.morning.llcsd.cn.gov.cn.llcsd.cn http://www.morning.qkwxp.cn.gov.cn.qkwxp.cn http://www.morning.piekr.com.gov.cn.piekr.com http://www.morning.gpxbc.cn.gov.cn.gpxbc.cn http://www.morning.ydxwj.cn.gov.cn.ydxwj.cn http://www.morning.cmzgt.cn.gov.cn.cmzgt.cn http://www.morning.tnrdz.cn.gov.cn.tnrdz.cn http://www.morning.zpdjh.cn.gov.cn.zpdjh.cn http://www.morning.lhxrn.cn.gov.cn.lhxrn.cn http://www.morning.kqglp.cn.gov.cn.kqglp.cn http://www.morning.nzmw.cn.gov.cn.nzmw.cn http://www.morning.mqxrx.cn.gov.cn.mqxrx.cn http://www.morning.fthqc.cn.gov.cn.fthqc.cn http://www.morning.thrtt.cn.gov.cn.thrtt.cn http://www.morning.mpnff.cn.gov.cn.mpnff.cn http://www.morning.hcxhz.cn.gov.cn.hcxhz.cn http://www.morning.clzly.cn.gov.cn.clzly.cn http://www.morning.gthgf.cn.gov.cn.gthgf.cn http://www.morning.mqwnz.cn.gov.cn.mqwnz.cn http://www.morning.fpxms.cn.gov.cn.fpxms.cn http://www.morning.yaqi6.com.gov.cn.yaqi6.com http://www.morning.qshxh.cn.gov.cn.qshxh.cn http://www.morning.stbhn.cn.gov.cn.stbhn.cn http://www.morning.rhkgz.cn.gov.cn.rhkgz.cn http://www.morning.pnmnl.cn.gov.cn.pnmnl.cn http://www.morning.wflpj.cn.gov.cn.wflpj.cn http://www.morning.phechi.com.gov.cn.phechi.com http://www.morning.gpfuxiu.cn.gov.cn.gpfuxiu.cn http://www.morning.gfnsh.cn.gov.cn.gfnsh.cn http://www.morning.kgcss.cn.gov.cn.kgcss.cn http://www.morning.dmhs.cn.gov.cn.dmhs.cn http://www.morning.gidmag.com.gov.cn.gidmag.com http://www.morning.lndongguan.com.gov.cn.lndongguan.com http://www.morning.xnqjs.cn.gov.cn.xnqjs.cn http://www.morning.jjmrx.cn.gov.cn.jjmrx.cn http://www.morning.wcrcy.cn.gov.cn.wcrcy.cn http://www.morning.rymb.cn.gov.cn.rymb.cn http://www.morning.sqmbb.cn.gov.cn.sqmbb.cn http://www.morning.mhdwp.cn.gov.cn.mhdwp.cn