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

📄 deconv.m

📁 卷积编译码的matlab仿真
💻 M
字号:
%函数名 deconv
%卷积码解码,输入参量:signalin,对应编码速率rate
%            输出参量:signalout
function[signalout]=deconv(signalin,rate)
l=size(signalin);
%插入dummy bit将信号还原成为编码速率为1/2的卷积码进行解码
%The poly2trellis function accepts a polynomial description of a
%convolutional encoder and returns the corresponding trellis structure description. 
%trellis = poly2trellis(ConstraintLength,CodeGenerator) performs the
%conversion for a rate k/n feedforward encoder. ConstraintLength is a 1-by-k vector that specifies the delay for the encoder's k input bit streams. 
%CodeGenerator is a k-by-n matrix of octal numbers that specifies the n output connections for each of the encoder's k input bit streams.
switch rate
    case 1/2
        TRELLIS=poly2trellis(7,[133,171])
    case 3/4
        TRELLIS=poly2trellis([3 3 3],[7 7 0 4;3 2 7 4;0 2 3 7]);
    case 2/3
         TRELLIS=poly2trellis([4,4],[15 15 6; 3 6 15]);
end
   

%1/2译码
%TRELLIS = 

 %    numInputSymbols: 2
  %  numOutputSymbols: 4
   %        numStates: 64
    %      nextStates: [64x2 double]
     %        outputs: [64x2 double]
     
  % Viterbi 解码
 
 CODE=signalin;
 TBLEN=7;
 %1/2*length(signal)
 OPMODE='trunc';%The encoder is assumed to have started at the all-zeros state. 
                % The decoder traces back from the state with the best metric. 
 DECTYPE='hard';%code contains binary input values.
 signalout = vitdec(CODE,TRELLIS,TBLEN,OPMODE,DECTYPE) ;

⌨️ 快捷键说明

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