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

📄 mdepuncturing.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
function [Out,BlkSize] = mDepuncturing(In,BlkSize,mode)
% Depuncturing for the FEC Decoder of IEEE 802.16-2004
% (WiMAX, OFDMA only)
%
%     [Out,BlkSize] = mDepuncturing(In,BlkSize,mode)
%
% In     : input column vector or matrix
%          one column per code block
% Out    : output column vector or matrix
%          one column per code block
% BlkSize: row vector, length = number of code blocks
%          number of data elements in each code block (or column)
% mode   : depuncture mode
%          0 = omitted = rate 1/1 (for overall conv rate 1/2)
%          1 = 1 of 4  = rate 4/3 (for overall conv rate 2/3)
%          2 = 2 of 6  = rate 3/2 (for overall conv rate 3/4)
%          3 = 4 of 10 = rate 5/3 (for overall conv rate 5/6)
%
% For mode=0 the output is the same as the input.
% For mode~=0 the output block size is bigger compared to the input block
% size.
% For mode=1 the input block size must be a multiple of 3.
% For mode=2 the input block size must be a multiple of 4.
% For mode=3 the input block size must be a multiple of 6.
%
% Matlab 7 Release 14SP2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: mDepuncturing.m.rca $
%  $Revision: 1.4 $
%  $Date: Thu Oct 19 17:46:45 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[m,n]=size(In);

%check dimensions
[x,y]=size(BlkSize);
if ((x~=1)|(y~=n))
    error('Error: BlkSize must be row vector with the same number of columns as In.');
end

switch(mode)
    case 0 %1/2 (X:1 Y:1)
        %do nothing
        Out = In;
    case 1 %2/3 (X:10 Y:11)
        if (any(mod(BlkSize,3)) | mod(m,3))
            error('Error: Input block size (for mode 1) is not a multiple of 3.');
        end
        Out = zeros(4,m/3,n,class(In));
        Out([1 2 4],:,:) = reshape(In,3,m/3,n);
        Out = reshape(Out, m*4/3, n);
        BlkSize=BlkSize/3*4;
    case 2 %3/4 (X:101 Y:110)
        if (any(mod(BlkSize,4)) | mod(m,4))
            error('Error: Input block size (for mode 2) is not a multiple of 4.');
        end
        Out = zeros(6,m/4,n,class(In));
        Out([1 2 4 5],:,:) = reshape(In,4,m/4,n);
        Out = reshape(Out, m*6/4, n);
        BlkSize=BlkSize/4*6;
    case 3 %5/6 (X:10101 Y:11010)
        if (any(mod(BlkSize,6)) | mod(m,6))
            error('Error: Input block size (for mode 3) is not a multiple of 6.');
        end
        Out = zeros(10,m/6,n,class(In));
        Out([1 2 4 5 8 9],:,:) = reshape(In,6,m/6,n);
        Out = reshape(Out, m*10/6, n);
        BlkSize=BlkSize/6*10;
    otherwise
        error('Error: Depuncturing mode unknown.');
end

⌨️ 快捷键说明

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