www.pudn.com > ldpc802.16.rar > McWillMap5MHz.m, change:2005-11-05,size:1298b


%interleaving 
clear all; 
CarIndex=0:639; 
for i=0:4, 
    for j=0:15, 
        SubChan{i+1,j+1}=i*128+j:16:(i+1)*128+j-1; 
    end; 
end; 
 
%example 
Allocation.ScGroup=[1 2 2 2 3 3 3 4 5 5]; 
Allocation.Sch=[1 3 5 3 2 6 5 8 4 2]; 
 
%coded bits to subchannel mapping rules 
%the rule tries to achieve best frequency-time diversity for FEC block 
%also the mapping should be backwards compatible with the old version 
pool=sort(Allocation.ScGroup); 
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),alloc{cnt}), 
            %pool non-empty and not assigned 
            alloc{cnt}=[alloc{cnt} pool(1)];             
            pool(1)=[]; 
        elseif ~isempty(pool) & ismember(pool(1),alloc{cnt}), 
            %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; 
tot_alloc=[]; 
for i=1:cnt, 
    tot_alloc=[tot_alloc alloc{i}]; 
end;