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

📄 conv_encd.m

📁 802.15 dsss 物理协议层方针代码
💻 M
字号:
function output=conv_encd(k,input)
%Convolutional Encoder
%
%The convolutional encoder is used to encode data  for FEC
%
%DS-UWB PHY 802.15
%Constraint length: k=4 or 6
%Generating polynomial: (15, 17) or (65, 57)
%Rate: 1/2
%
% Arguments: k - constraint length
%                      input - input data
%                      output - output date
%
%Author: Liu Hantao
%
%==============================================================
%check the input arguments
if (nargin ~= 2) 
    error('incorrect number of input arguments - two expected')
end
%determine the generating matrix of convolutional code
switch k
    case 4
        g=[1 1 0 1;1 1 1 1];
    case 6
        g=[1 1 0 1 0 1;1 0 1 1 1 1];
    otherwise
         error('incorrect number of constraint length')
end
%determine the length of input data
N=length(input);
%==============================================================
%convolute the input date
%determine k and n
k=size(g,2);
n=size(g,1);
%add extra zeros to ensure the initial values and final values of the
%convolutional encoder are zeros
u=[zeros(size(1:(k-1))),input,zeros(size(1:(k-1)))];
%generate uu, a matrix whose columns are the contents of convolutional
%encoder at various clock cycles
uk=u(k:-1:1);
for i=1:N+k-2
    uk=[uk,u(i+k:-1:i+1)];
end
uu=reshape(uk,k,N+k-1);
%output the data of convolutional encoder
output=reshape(rem(g*uu,2),1,n*(k+N-1));
% commented by Guoxin Jin
% output=output_temp(1:2*length(input));
% might be this
%==============================================================

⌨️ 快捷键说明

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