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

📄 mulcodeblockseg.m

📁 OFDMA 物理层开发的matlab 源码.飞思卡尔提供.对物理层开发的工程师有帮助!
💻 M
字号:
% Uplink slot desegmentation for OFDMA of IEEE 802.16 (WiMAX)
%
%     [OutData,BlkSize,OutPilot] = mULCodeBlockSeg(InData,BurstD,InPilot)
%
% This module de-segmentates all slots of a burst into code blocks dependent
% on the defined burst dimension and FEC coding.
%
% InData  : data input matrix (complex or real, see switch)
% InPilot : pilot input matrix (complex or real, see switch)
% BurstD  : burst descriptor
%
% OutData : data output matrix (complex or real, see switch)
%           One column per code block, the number of elements in each column
%           is the maximum code block size for the specified FEC code.
% OutPilot: pilot output matrix (complex or real, see switch)
%           same format as OutData
% BlkSize : row vector, length = number of code blocks
%           number of complex data symbols for each code block
%
% Matlab 7 Release 14 SP2

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Property of Freescale
%  Freescale Confidential Proprietary
%  Freescale Copyright (C) 2005 All rights reserved
%  ----------------------------------------------------------------------------
%  $RCSfile: mULCodeBlockSeg.m.rca $
%  $Revision: 1.1 $
%  $Date: Fri Nov 17 10:30:58 2006 $
%  Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function [OutData,BlkSize,OutPilot] = mULCodeBlockSeg(InData,BurstD,InPilot)

if isreal(InData) %call the LIB2 function
    [OutData,BlkSize] = mSlotDesegLIB2(InData,BurstD);
    OutPilot='notAvailable';
else %call the original
    [OutData,BlkSize,OutPilot] = mSlotDeseg_old(InData,BurstD,InPilot);
end




%-- LIB2 mSlotDeseg
function [OutData,BlkSize] = mSlotDesegLIB2(InData,BurstD)


[m,Ns] = size(InData);

%check input length
if Ns~=(BurstD.Slots)
    error('Error: Number of input slots do not match the burst profile.');
end
if (m~=BurstD.R*48*BurstD.ModMode)
    error('Error: Number of elements in the slots is not in line with repetition factor.');
end

%number of code blocks (matlab version, including division)
%CodeBlks = ceil(Ns/BurstD.J);
%number of code blocks (efficient C version)
Aux = [32767,16383,10922,8191, 0, 5461];
CodeBlks = bitshift(Ns*Aux(BurstD.J),-15)+1;

%number of slots in each code block
if CodeBlks==1
    NumSlots=Ns;
elseif CodeBlks==2
    temp=bitshift(Ns,-1);
    NumSlots=[Ns-temp,temp];
elseif CodeBlks>2
    partial=Ns-(CodeBlks-2)*BurstD.J;
    temp=bitshift(partial,-1);
    NumSlots=[BurstD.J*ones(1,CodeBlks-2),partial-temp,temp];
end

%allocate and generate data output
OutData=zeros(m*BurstD.J,CodeBlks,class(InData));
slot=1;
for b=1:CodeBlks,
    for s=0:NumSlots(b)-1,
        OutData(s*m+(1:m),b) = InData(1:m,slot);
        slot=slot+1;
    end
end
BlkSize = NumSlots*m;





%-- Original mSlotDeseg
function [OutData,BlkSize,OutPilot] = mSlotDeseg_old(InData,BurstD,InPilot)

[m,Ns] = size(InData);

%check input length
if Ns~=(BurstD.Slots)
    error('Error: Number of input slots do not match the burst profile.');
end
if (m~=BurstD.R*48)
    error('Error: Number of elements in the slots is not in line with repetition factor.');
end

%number of code blocks (matlab version, including division)
%CodeBlks = ceil(Ns/BurstD.J);
%number of code blocks (efficient C version)
Aux = [32767,16383,10922,8191, 0, 5461];
CodeBlks = bitshift(Ns*Aux(BurstD.J),-15)+1;

%number of slots in each code block
if CodeBlks==1
    NumSlots=Ns;
elseif CodeBlks==2
    temp=bitshift(Ns,-1);
    NumSlots=[Ns-temp,temp];
elseif CodeBlks>2
    partial=Ns-(CodeBlks-2)*BurstD.J;
    temp=bitshift(partial,-1);
    NumSlots=[BurstD.J*ones(1,CodeBlks-2),partial-temp,temp];
end

%allocate and generate data output
OutData=zeros(m*BurstD.J,CodeBlks,class(InData));
slot=1;
for b=1:CodeBlks,
    for s=0:NumSlots(b)-1,
        OutData(s*m+(1:m),b) = InData(1:m,slot);
        slot=slot+1;
    end
end
BlkSize = NumSlots*m;


%take into account corresponding pilots as well if required
if ~isempty(InPilot)
    %check pilot slot vector
    [r,c]=size(InPilot);
    if (m~=r*2) | (c~=Ns)
        error('Error: Data & pilot array sizes do not match.');
    end

    %allocate and generate pilot output
    OutPilot=zeros(r*BurstD.J,CodeBlks,class(InPilot));
    slot=1;
    for b=1:CodeBlks,
        for s=0:NumSlots(b)-1,
            OutPilot(s*r+(1:r),b) = InPilot(1:r,slot);
            slot=slot+1;
        end
    end
else
    OutPilot=[];
end

⌨️ 快捷键说明

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