viterbi_uwb.m

来自「实现MB-OFDM UWB 中的Viterbi译码功能; 包括自己编写的vit」· M 代码 · 共 37 行

M
37
字号
function viterbi_output = VITERBI_UWB(viterbi_input,vit_typ,data_typ)
%   VITERBI_UWB implements viterbi decoding for input sequence
%   traced back from zero states; encoder starts and ends at the all-zeros
%   states
%   viterbi_input, input sequence;
%   vit_typ, input type; 0, hard decision input; 1, soft decision input
%   viterbi_output, output of decoding bit stream
%   data_typ, 0, plcp header decoding; 1, psdu decoding;



% convolutional encoder parameters
global g_L;  % constraint length
global g_G_tab;  % generator polynomial of convolutional encoder
global g_tblen_var;    % trace back length
global g_vit_typ_var;   % decision type
global g_soft_bit_len;   % soft decision input word length

trellis = poly2trellis(g_L,g_G_tab); % Define trellis.

if(data_typ==0)  %header decoding
    
    if(vit_typ==0)    % hard decision
       viterbi_output = vitdec(viterbi_input,trellis,g_tblen_var,'trunc','hard'); % Decode.    
    else              % soft decision    
       viterbi_output = vitdec(viterbi_input,trellis,g_tblen_var,'trunc','soft',g_soft_bit_len); % Decode.
    end;

else     % psdu decoding
    if(vit_typ==0)    % hard decision
       viterbi_output = vitdec(viterbi_input,trellis,g_tblen_var,'term','hard'); % Decode.    
    else              % soft decision    
       viterbi_output = vitdec(viterbi_input,trellis,g_tblen_var,'term','soft',g_soft_bit_len); % Decode.
    end;
    
end;
    

⌨️ 快捷键说明

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