mapper.m
来自「OFDM transmitter, including signal mappi」· M 代码 · 共 39 行
M
39 行
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 + =
减小字号Ctrl + -
显示快捷键?