资源简介

用于无线通信的信道编码,用matlab编写的模块用于无线通信的信道编码,用matlab编写的模块用于无线通信的信道编码,用matlab编写的模块用于无线通信的信道编码,用matlab编写的模块

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Channel Encoding
%%  Copyright by Zheng Chen Potevio Institute of Technology
%%  Modification:
%%  Ver.1.0  2007-07-19
%%  Ver.1.1  2007-08-08  support svc lists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% function Out = ChanEncode(In Params)
%% Parameter Describtion:
%% Input  : 
%%   In         :  dada bits for encoding
%%   Params     :  simulation parameters
%% Output : 
%%   Out        :  codeword
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function Out = ChanEncode(In Params)

CodeType = Params.CodeType;
SO = Params.SimOptions;
bit_per_frame = SO.CodeK;  % info bits                                     %720
Ri = SO.CodeR;                                                             %码率0.3

%% mapping order selection
mod_type = Params.ModulateMode;
mapp_type = Params.MappMode;

num_of_frame = SO.CodeC;                                                   %frame num

if ( rem( num_of_frame*numel(In) bit_per_frame ) )                      
    error( ‘data length needs to be an integer multiple of the info length‘ );
end
InfoBit = reshape(In num_of_frame bit_per_frame);                      

for index = 1:num_of_frame
    % turbo code
    if (CodeType == 1)
        CodeBit(index:) = TurboEncode(InfoBit(index:) Params);
        
    % ldpc code
    elseif (CodeType == 2)
        if (mapp_type == 1)
            CodeBit_C = LdpcEncode( InfoBit(index:) bit_per_frame Ri );
            MappCode = LdpcReorder(CodeBit_C bit_per_frame);
            NumBit = length(MappCode);
            MappIdx = MappIndex(NumBit mod_type);
            MappCode_P = MappCode;
            for ii = 1 : NumBit
                MappCode_C(ii) = MappCode_P(MappIdx(ii));
            end
            CodeBit(index:) = MappCode_C;
        else
            CodeBit(index:) = LdpcEncode( InfoBit(index:) bit_per_frame Ri );
        end
    
    % convolutional code
    elseif (CodeType == 3)
        CodeBit(index:) = ConvolEncode( InfoBit(index:) CodeType );
    
    % uncoded case
    else
        CodeBit(index:) = InfoBit(index:);
    end

end

Ni = SO.CodeN;
[row col] = size(CodeBit);
nn = row * col;
CodeBit_p = reshape(CodeBit 1 nn);
fill_bits = SO.FillRMBit;
if ( fill_bits>0)
    Out = CodeBit_p( 1 : Ni );
elseif (fill_bits<0)
    Out = horzcat(CodeBit_p zeros(1fill_bits));
else
    Out = CodeBit_p;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% End of ChanEncode()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Turbo Encoder
%%  Copyright by Zheng Chen Potevio Institute of Technology
%%  Modification:
%%  Ver.1.0  2007-07-04
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件       13636  2018-02-15 20:59  ChanEncode.m
     目录           0  2018-02-15 20:59  __MACOSX\
     文件         671  2018-02-15 20:59  __MACOSX\._ChanEncode.m

评论

共有 条评论