depunct.m

来自「UWB viterbi decode matlab代码; 包括自己实现的mat」· M 代码 · 共 73 行

M
73
字号
function depunct_output=DEPUNCT(deinterlv_output,dumy_bit)
%   DEPUNCT implements depuncture  of input bit sequence
%   deinterlv_output,  bit stream after bit deinterleaver
%   depunct_output,  depuncture output bit stream
%  dumy_bit,  dummy bit, decided by soft decision bit number

%  Author(s):     Feng Xianjun, 
%          Date:    2008-05-05
%  Copyright 2005-2009 The Panovel, Inc.


global g_phy_para;  % system  parameters for PHY


code_rate=g_phy_para(6);
input_len=length(deinterlv_output);




switch code_rate
    case 1/3
        depunct_output=deinterlv_output;
        return;
    case 1/2
        if(mod(length(deinterlv_output),2)~=0)
            fprintf('length of input sequence is error in DEPUNCT\n');
            return;
        end;
        
        output_len=input_len*3/2;
        constr_mat=dumy_bit*ones(3,input_len/2);% construct matrix 
        temp_depunct=reshape(deinterlv_output,2,input_len/2);
        constr_mat(1,:)=temp_depunct(1,:);
        constr_mat(3,:)=temp_depunct(2,:);
        depunct_output=reshape(constr_mat,1,output_len);  % row vector
        
        
        
    case 5/8
        if(mod(length(deinterlv_output),8)~=0)
            fprintf('length of input sequence is error in DEPUNCT\n');
            return;
        end;
        output_len=input_len*15/8;
        constr_mat=dumy_bit*ones(input_len/8,15);% construct matrix 
        temp_depunct=reshape(deinterlv_output,8,input_len/8);
        temp_depunct=temp_depunct';
        constr_mat(:,1:2)=temp_depunct(:,1:2);
        constr_mat(:,6:8)=temp_depunct(:,3:5);
        constr_mat(:,12:14)=temp_depunct(:,6:8);
        constr_mat=constr_mat';
        depunct_output=reshape(constr_mat,1,output_len);  % row vector
        
    case 3/4
        if(mod(length(deinterlv_output),4)~=0)
            fprintf('length of input sequence is error in DEPUNCT\n');
            return;
        end;
        output_len=input_len*9/4;
        constr_mat=dumy_bit*ones(input_len/4,9);% construct matrix 
        temp_depunct=reshape(deinterlv_output,4,input_len/4);
        temp_depunct=temp_depunct';
        constr_mat(:,1:2)=temp_depunct(:,1:2);
        constr_mat(:,6)=temp_depunct(:,3);
        constr_mat(:,9)=temp_depunct(:,4);
        constr_mat=constr_mat';
        depunct_output=reshape(constr_mat,1,output_len);  % row vector
        
end;

    

⌨️ 快捷键说明

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