encoder.m

来自「OFDM信号的循环谱密度」· M 代码 · 共 26 行

M
26
字号
function output = encoder(input,TXVECTOR,SIGNAL_FLAG)
% convolutional encoder
% input: row vector of SIGNAL field or DATA field
% TXVECTOR: structure of TXVECTOR parameters
% SIGNAL_FLAG: indicator of SIGNAL field
% output: row vector of encoded SIGNAL field or DATA field

if nargin == 2 % encoding DATA field
    rate = TXVECTOR.DATARATE;
else % encoding SIGNAL field
    rate = 6;
end;

trellis = poly2trellis(7,[133,171]); % trellis structure

switch rate
    case 6
        output = convenc(input,trellis); % convolutional encoding
    case 12
        %%puncpat = [1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1]; % puncture pattern
        %%output = convenc(input,trellis,puncpat); % convolutional encoding
        output = convenc(input,trellis); % convolutional encoding
    otherwise
        error('parameter not supported');
end;

⌨️ 快捷键说明

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