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

📄 untitled.m

📁 this file consists of many matlab programs
💻 M
字号:
%A cyclic code is a linear block code with the property that cyclic shifts
%of a codeword (expressed as a series of bits) are also codewords
clear;
clc;
 % Set codeword length and message length
n = input(' enter the length of codeword ');
k = input(' enter the length of message ');
% Message is a binary column.
msg = input(' enter the message ');
%The cyclpoly function produces generator polynomials for cyclic codes.
%genpoly = cyclpoly(n,k)
genpoly=[1 1 0 1]
%To find a parity-check and generator matrix for a cyclic code, use the
%cyclgen function
[parmat,genmat] = cyclgen(n,genpoly)
code = encode(msg,n,k,'cyclic',genpoly)
%gfweight turns the minimum distance of the cyclic code whose codeword
%length is n and whose generator polynomial is represented by genpoly.
wt = gfweight(genpoly,n)
% Produce decoding table
trt = syndtable(parmat)
%decodes the cyclic code code and tries to correct errors using the decoding
%table trt, where trt is a 2^(n-k)-by-n matrix. genpoly is a row vector 
%that gives the coefficients, in order of ascending powers, of the binary 
%generator polynomial of the code. the number of errors detected in ERR a negative integer indicates that there are more errors than can be corrected.
%the corrected codeword CCODE vector cerr the number of errors corrected in the rth codeword
[msg,err,ccode,cerr]= decode(code,n,k,'cyclic',genpoly,trt)

⌨️ 快捷键说明

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