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

📄 convolutional_encoder.m

📁 20072010.rar:tubor,LDPC,convolution的部分代码
💻 M
字号:
function [encoded_bits, final_state] = convolutional_encoder(input_bits, trellis, system_info, varargin)


% This function encodes the binary vector input_bits using the
% convolutional encoder whose trellis structure is trellis

% The initial_state specifies the starting state of the 
% encoder registers.

% It can also returns the final_state of the encoder's state.

current_state = 1;

nvarargin = nargin - 3;

switch(nvarargin)
    case {1}
        if isempty(varargin(1))
            current_state = varargin(1) + 1;
        end
end

for input = 1:system_info.uncoded_frame_length
    encoded_symbol = trellis.nextOutputs(current_state, input_bits(input) + 1);
    current_state = trellis.nextStates(current_state, input_bits(input) + 1) + 1;
    encoded_bits(((input - 1) * system_info.n + 1):(input * system_info.n)) = de2bi(encoded_symbol, system_info.n, 'left-msb');
end
final_state = current_state - 1;

⌨️ 快捷键说明

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