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

📄 mapper.m

📁 OFDM transmitter, including signal mapping for M-QAM and quantizer
💻 M
字号:
function mapper_output = mapper(data,total_bits_number,bit_number)

temp = reshape(data,bit_number,(total_bits_number/bit_number));
mapper_output = [];
mapper_output_real = [];
mapper_output_imag = [];
mapper_output_real_temp = [];
mapper_output_imag_temp = [];
for n = 1:(total_bits_number/bit_number)
    for m = 1: (bit_number/2)
        if ( temp(2*m-1,n) == 0)       
            mapper_output_imag_temp(m,n) = (2^(bit_number/2-m));
        else
            mapper_output_imag_temp(m,n) = -(2^(bit_number/2-m));
        end      
        if (temp(2*m,n) == 0)
            mapper_output_real_temp(m,n) = (2^(bit_number/2-m));
        else
            mapper_output_real_temp(m,n) = -(2^(bit_number/2-m));
        end
        if ( m ~= 1 )
            if (temp(2*(m-1)-1,n) == 1)
                 mapper_output_imag_temp(m,n) = -mapper_output_imag_temp(m,n);
            end
            if (temp(2*(m-1),n) == 1)
                mapper_output_real_temp(m,n) = -mapper_output_real_temp(m,n);
            end
        end
    end
end
if (bit_number ~= 2)
    mapper_output_real = sum(mapper_output_real_temp);
    mapper_output_imag = sum(mapper_output_imag_temp);
else
    mapper_output_real = mapper_output_real_temp;
    mapper_output_imag = mapper_output_imag_temp;
end
mapper_output = mapper_output_real + mapper_output_imag*j;
        

⌨️ 快捷键说明

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