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

📄 cnv_encd.m

📁 convolution coding program using viterabi algorithm
💻 M
字号:
function output=cnv_encd(g,k0,input)
input=2;
k0=1;
% the convolutional encoder
% g is the generator matrix of the convolutional code
% k0 is the number of bits entering the encoder at each clock cycle.
% Check to see if extra zero-padding is necessary.
if rem(length(input),k0) > 0
input=[input,zeros(size(1:k0-rem(length(input),k0)))];
end
n=length(input)/k0;
% Check the size of matrix g.
if rem(size(g,2),k0) > 0
error('Error, g is not of the right size.')
end
% Determine l and n0.
l=size(g,2)/k0;
n0=size(g,1);
% add extra zeros
u=[zeros(size(1:(l-1)*k0)),input,zeros(size(1:(l-1)*k0))];
u1=u(l*k0:-1:1);
for i=1:n+l-2
u1=[u1,u((i+l)*k0:-1:i*k0+1)];
end
uu=reshape(u1,l*k0,n+l-1);
% Determine the output
output=reshape(rem(g*uu,2),1,n0*(l+n-1));

⌨️ 快捷键说明

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