📄 viterbi_uwb.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -