📄 mpuncturing.m
字号:
function [Out,BlkSize] = mPuncturing(In,BlkSize,mode)
% Puncturing for the FEC Encoder for OFDMA
% of IEEE 802.16-2004 (WiMAX)
%
% [Out,BlkSize] = mPuncturing(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 : puncture 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 smaller compared to the input block
% size.
% For mode=1 the input block size must be a multiple of 4.
% For mode=2 the input block size must be a multiple of 6.
% For mode=3 the input block size must be a multiple of 10.
%
% Matlab 7 Release 14SP2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mPuncturing.m.rca $
% $Revision: 1.5 $
% $Date: Sun Oct 22 14:23:20 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,4)) || mod(m,4))
error('Error: Input block size (for mode 1) is not a multiple of 4.');
end
temp = reshape(In, [4,m/4, n]);
Out = reshape(temp([1 2 4],:,:), m/4*3, n);
BlkSize=BlkSize/4*3;
case 2 %3/4 (X:101 Y:110)
if (any(mod(BlkSize,6)) || mod(m,6))
error('Error: Input block size (for mode 2) is not a multiple of 6.');
end
temp = reshape(In, [6,m/6, n]);
Out = reshape(temp([1 2 4 5],:,:), m/6*4, n);
BlkSize=BlkSize/6*4;
case 3 %5/6 (X:10101 Y:11010)
if (any(mod(BlkSize,10)) || mod(m,10))
error('Error: Input block size (for mode 3) is not a multiple of 10.');
end
temp = reshape(In, [10,m/10, n]);
Out = reshape(temp([1 2 4 5 8 9],:,:), m/10*6, n);
BlkSize=BlkSize/10*6;
otherwise
error('Error: Puncturing mode unknown.');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -