qam16_mapping.m

来自「这个第四代移动通信中」· M 代码 · 共 60 行

M
60
字号
function V_blast_map_blk = qam16_mapping( b_in ,LEN);

%this function do the function of 16QAM Mapping, the input series is a
%random number,the out put is the V_BALST symble blocks

%-----------------------------------------------------------------------

%b_in = [rand(1,LEN) > 0.5];
%----------------------------------------------------------------------
%16QAM Mapping
M = 4;% M Transmitter
N = 4;% N Receiver

    
window = 4;%16QAM
s(1:LEN/window) = 0;
for index = 0:LEN/window-1;
    cur_sym_bit = b_in([index*4+1:index*4 + window]);   %to get 4 bit;
    BitValue = cur_sym_bit(1,1)*8 + cur_sym_bit(1,2)*4 + cur_sym_bit(1,3)*2 + cur_sym_bit(1,4);
    switch BitValue;
        case 10%[1 0 1 0] 
            s(1,index+1) = 3+3*i;
        case 11%[1 0 1 1]
            s(1,index+1) = 3+1*i;
        case 9%[1 0 0 1]
            s(1,index+1) = 3-1*i;
        case 8%[1 0 0 0]
            s(1,index+1) = 3-3*i;
        case 14%[1 1 1 0]
            s(1,index+1) = 1+3*i;
        case 15%[1 1 1 1]
            s(1,index+1) = 1+1*i;
        case 13%[1 1 0 1]
            s(1,index+1) = 1-1*i;
        case 12%[1 1 0 0]
            s(1,index+1) = 1-3*i;
        case 6%[0 1 1 0]
            s(1,index+1) = -1+3*i;
        case 7%[0 1 1 1]
            s(1,index+1) = -1+1*i;
        case 5%[0 1 0 1]
            s(1,index+1) = -1-1*i;
        case 4%[0 1 0 0]
            s(1,index+1) = -1-3*i;
        case 2%[0 0 1 0]
            s(1,index+1) = -3+3*i;
        case 3%[0 0 1 1]
            s(1,index+1) = -3+1*i;
        case 1%[0 0 0 1]
            s(1,index+1) = -3-1*i;
        case 0%[0 0 0 0]
            s(1,index+1) = -3-3*i;
    end;
end;

%-----------------------------------------------------------------------
V_blast_map_blk = s;
size(V_blast_map_blk);
length(V_blast_map_blk);

⌨️ 快捷键说明

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