www.pudn.com > ldpc802.16.rar > SubChanMap.m, change:2005-11-07,size:2662b


function [x,tot_alloc]=SubChanMap(SymIn,Allocation,System,SubChanFormat,SubChanToCar) 
 
%generate OFDM modulatable data based on input symbols and subchannel allocation 
%the input symbols will be read in the original order 
% x=SubChanMap(SymIn,Allocation,SubChanToCar) 
% inputs:  
%   SymIn: vector of coded symbols to be mapped 
%   SymOut: format for symbol out 
%   Allocation: subchannel allocation including subcarrier group index and 
%               subchannel index 
%   SubChanFormat: definition of subchannel 
%   SubChanToCar: subchannel to subcarrier index mapping 
% Outputs: 
%   x: symbols to be used for OFDM signal generation 
%   tot_alloc: {subcarrier group index, subchannel index} for coded symbols 
%               to subchannel mapping 
% 2005.11.6, Hang Li 
                     
%coded bits to subchannel mapping rules 
%the rule tries to achieve best frequency-time diversity for FEC block 
[pool(1,:),I]=sort(Allocation.CarGroupSch(1,:)); 
pool(2,:)=Allocation.CarGroupSch(2,I); 
second_pool=[]; 
cnt=1; alloc{1}=[]; 
while length([pool second_pool])>0, 
    if isempty(alloc{cnt}), 
        alloc{cnt}=[alloc{cnt} pool(:,1)]; 
        pool(:,1)=[]; 
    else,         
        if ~isempty(pool) & ~ismember(pool(1,1),alloc{cnt}(1,:)), 
            %pool non-empty and not assigned 
            alloc{cnt}=[alloc{cnt} pool(:,1)];             
            pool(:,1)=[]; 
        elseif ~isempty(pool) & ismember(pool(1,1),alloc{cnt}(1,:)), 
            %pool non-empty and assgined 
            second_pool=[second_pool pool(:,1)]; 
            pool(:,1)=[];             
        else 
            %pool empty 
            cnt=cnt+1; 
            alloc{cnt}=[];             
            pool=second_pool; 
            second_pool=[]; 
        end; 
    end; 
end; 
%generate aggregated allocation 
tot_alloc=[]; 
for i=1:cnt, 
    tot_alloc=[tot_alloc alloc{i}]; 
end; 
NsymPerSc=SubChanFormat.Nf*SubChanFormat.Nt-size(SubChanFormat.Pilot,2); 
NschUsed=length(SymIn)/NsymPerSc; 
x=zeros(System.Nfft,SubChanFormat.Nt); 
tone_st=(System.Nfft-System.Nused)/2; 
sym_st=1; 
for si=1:SubChanFormat.Nt,                      %time second 
    SchPilotFreqInd=SubChanFormat.Pilot(1,find(SubChanFormat.Pilot(2,:)==si)); 
    for sc=1:NschUsed,                 %subchannel 
        PhyFreqIndex=SubChanToCar{tot_alloc(1,sc),tot_alloc(2,sc)}; 
        SubcarUsedIndex=setdiff(1:SubChanFormat.Nf,SchPilotFreqInd); 
        if length(SubcarUsedIndex)>0, 
            x(tone_st+PhyFreqIndex(SubcarUsedIndex)+1,si)=SymIn(sym_st:sym_st+length(SubcarUsedIndex)-1); 
            sym_st=sym_st+length(SubcarUsedIndex); 
        end; 
    end; 
end;