📄 mslotdemap.m
字号:
% Uplink Rx slot data and pilot demapping for OFDMA of IEEE 802.16 (WiMAX)
%
% [DataSlots,PilotSlots] = mSlotDemap(SlotVecs,ZoneD,BurstD,PilotVecs)
%
% This module performes the segmentation of the modulated burst data into
% into slots.
%
% SlotVecs: input matrix that is the data FP interface (complex or real, see switch)
% one column per slot vector, 48*ZoneD.NumSubch rows
% PilotVecs: input matrix that is the pilot FP interface (complex or real,
% see switch)
% one column per slot vector, 24*ZoneD.NumSubch rows
% ZoneD : zone descriptor
% BurstD : burst descriptor
%
% Matlab 7 Release 14 SP2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: mSlotDemap.m.rca $
% $Revision: 1.7 $
% $Date: Tue Nov 28 07:32:57 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [DataSlots,PilotSlots,SlotX,SlotY] = mSlotDemap(SlotVecs,ZoneD,BurstD,PilotVecs)
if isreal(SlotVecs) %call the LIB2 mSlotDemap function
[DataSlots,SlotX,SlotY] = mSlotDemapLIB2(SlotVecs,ZoneD,BurstD);
PilotSlots='NotAvailable';
else %call the original mSlotDemap
[DataSlots,PilotSlots,SlotX,SlotY] = mSlotDemap_c(SlotVecs,ZoneD,BurstD,PilotVecs);
end
%-- Original mSlotDemap
function [DataSlots,PilotSlots,SlotX,SlotY] = mSlotDemap_c(SlotVecs,ZoneD,BurstD,PilotVecs)
[r,c]=size(SlotVecs);
%allocated slots
Ns = BurstD.Duration;
%check burst dimension
if mod(BurstD.SymOff,ZoneD.Type)
error('Error: OFDMA symbol offset does not match zone type.');
end
if (BurstD.Duration > (ZoneD.NumSym*(ZoneD.NumSubch-BurstD.SubchOff)-BurstD.SymOff)/ZoneD.Type);
error('Error: Burst size exceeds zone dimension.');
end
%check zone dimension
if ((ZoneD.NumSym/ZoneD.Type)~=c)
error('Error: Number of provided slot vectors does not match zone dimension.');
end
if ((ZoneD.NumSubch*48)~=r)
error('Error: Slot vector length does not match zone dimension.');
end
% Offset to start of burst
OffX1 = BurstD.SymOff/ZoneD.Type; % OFDMA symbol offset
OffY1 = BurstD.SubchOff; % subchannel offset
% Offset to end of burst
OffX2 = mod(OffX1+BurstD.Duration,ZoneD.NumSym/ZoneD.Type);
OffY2 = OffY1+floor((OffX1+BurstD.Duration)/ZoneD.NumSym*ZoneD.Type);
% for each slot calculate the offsets
SlotX=zeros(1,BurstD.Duration); % OFDMA symbol offsets
SlotY=zeros(1,BurstD.Duration); % subchannel offsets
z=1;
for x=0:OffX1-1,
if (x<OffX2)
for y=OffY1+1:OffY2,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
else
for y=OffY1+1:OffY2-1,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
end
end
for x=OffX1:(ZoneD.NumSym/ZoneD.Type)-1,
if (x<OffX2)
for y=OffY1:OffY2,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
else
for y=OffY1:OffY2-1,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
end
end
%copy and order data slots from SlotVecs
DataSlots = zeros(48,BurstD.Duration,class(SlotVecs));
for k=1:BurstD.Duration,
DataSlots(:,k) = SlotVecs(SlotY(k)*48+(1:48),SlotX(k)+1);
end
%consider repetition
if BurstD.R>1
DataSlots=reshape(DataSlots,48*BurstD.R,BurstD.Duration/BurstD.R);
end
%take into account corresponding pilots as well if required
if ~isempty(PilotVecs)
%check pilot slot vector
[m,n]=size(PilotVecs);
if (r~=m*2) | (c~=n)
error('Error: Data & pilot slot vector sizes do not match.');
end
%copy and order pilot slots from PilotVecs
PilotSlots = zeros(24,BurstD.Duration,class(PilotVecs));
for k=1:BurstD.Duration,
PilotSlots(:,k) = PilotVecs(SlotY(k)*24+(1:24),SlotX(k)+1);
end
%consider repetition
if BurstD.R>1
PilotSlots=reshape(PilotSlots,24*BurstD.R,BurstD.Duration/BurstD.R);
end
else
PilotSlots=[];
end
%-- LIB2 function
function [DataSlots,SlotX,SlotY] = mSlotDemapLIB2(SlotVecs,ZoneD,BurstD)
[r,c]=size(SlotVecs);
%allocated slots
Ns = BurstD.Duration;
%check burst dimension
if mod(BurstD.SymOff,ZoneD.Type)
error('Error: OFDMA symbol offset does not match zone type.');
end
if (BurstD.Duration > (ZoneD.NumSym*(ZoneD.NumSubch-BurstD.SubchOff)-BurstD.SymOff)/ZoneD.Type);
error('Error: Burst size exceeds zone dimension.');
end
%check zone dimension
if ((ZoneD.NumSym/ZoneD.Type)~=c)
error('Error: Number of provided slot vectors does not match zone dimension.');
end
if ((ZoneD.NumSubch*48*BurstD.ModMode)~=r)
error('Error: Slot vector length does not match zone dimension.');
end
% Offset to start of burst
OffX1 = BurstD.SymOff/ZoneD.Type; % OFDMA symbol offset
OffY1 = BurstD.SubchOff; % subchannel offset
% Offset to end of burst
OffX2 = mod(OffX1+BurstD.Duration,ZoneD.NumSym/ZoneD.Type);
OffY2 = OffY1+floor((OffX1+BurstD.Duration)/ZoneD.NumSym*ZoneD.Type);
% for each slot calculate the offsets
SlotX=zeros(1,BurstD.Duration); % OFDMA symbol offsets
SlotY=zeros(1,BurstD.Duration); % subchannel offsets
z=1;
for x=0:OffX1-1,
if (x<OffX2)
for y=OffY1+1:OffY2,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
else
for y=OffY1+1:OffY2-1,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
end
end
for x=OffX1:(ZoneD.NumSym/ZoneD.Type)-1,
if (x<OffX2)
for y=OffY1:OffY2,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
else
for y=OffY1:OffY2-1,
SlotX(z)=x;
SlotY(z)=y;
z=z+1;
end
end
end
%copy and order data slots from SlotVecs
DataSlots = zeros(48*BurstD.ModMode,BurstD.Duration,class(SlotVecs));
for k=1:BurstD.Duration,
DataSlots(:,k) = SlotVecs(SlotY(k)*48*BurstD.ModMode+(1:48*BurstD.ModMode),SlotX(k)+1);
end
%consider repetition
if BurstD.R>1
DataSlots=reshape(DataSlots,48*BurstD.ModMode*BurstD.R,BurstD.Duration/BurstD.R);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -