📄 cyclic.m
字号:
%%non systematic cyclic coder %%
clc;
clear;
%ENCODER SECTION
n=input('enter the value of n ');
k=input('enter the value of k ');
q=n-k;
z=0;
fprintf('\nthe degree of polynomial is %d',n-1);
p=input('\nenter the coefficients of the polynomial ')
b=p(:,end:-1:1);
[j,i]=size(b);
if i~=(n)
disp('invalid polynomial')
else
for x=q:-1:0
z=z+1;
for y=i:-1:1
c=(y+x)*b(1,y);
if c~=0
g1(z,c)=1;
end
end
end
end
disp('the generator matrix is')
g=g1(:,end:-1:1)
fprintf('the message bit length should be %d\n',k)
m=input('enter the message bits ');
for u=1:1:n
code(1,u)=0;
for v=1:1:k
code(1,u) = rem((code(1,u) + m(1,v)*g(v,u)),2);
end
fprintf('\n\tcode%d = %d\n',u,code(1,u));
end
disp('the code is c=')
disp(code)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -