condecoder.m

来自「详细的OFDM设计过程」· M 代码 · 共 44 行

M
44
字号
function  dehard = condecoder(code)

% This is simulation for convolutioanl decoder.
% Based on the encoder of Matlab file "conencoder"

% - code: input of the decoder
% - desoft: decoded signal by soft decoding
% - dehard: decoded signal by hard decoding
% - n_encoderbits: rate 1/n_encoderbits

% ------- condecoder.m ------------------------------------
% Black team
% April-08-05
% ----------------------------------------------------------

% trellis = poly2trellis(constraintlength, codegenerator)

% Convert convolutional code polynomial to rellis description
% - CONSTRAINTLENGTH is a 1-by-k vector specifying the delay for each of the k input 
%     bit streams.
% - CODEGENERATOR is a k-by-n matrix of octal numbers specifying the n output 
%     connections for each of the k inputs.
% perform the binary-to-octal conversion in MATLAB by using code like 
%    str2num(dec2base(bin2dec('110'),8))

global encoder_order
n_encoderbits = encoder_order;

% DECODING 
    if n_encoderbits==2
        trellis = poly2trellis(3,[7 5]);
        tblen=1;
%         desoft = vitdec(code,trellis,tblen,'cont','soft',1);
        dehard = vitdec(code,trellis,tblen,'trunc','hard');
    end

    if n_encoderbits==3
        trellis3 = poly2trellis(3,[7 7 5]);
        tblen=1;
%         desoft = vitdec(code,trellis3,tblen,'cont','soft',1);
        dehard = vitdec(code,trellis3,tblen,'trunc','hard');
    end

⌨️ 快捷键说明

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