📄 qammod.m
字号:
%+----------------------------------------------------------------+
%| |
%| Name: qammod.m |
%| Author: Mathew Liu, James Shen |
%| Description: takes in a binary stream "in_binary" and maps |
%| them to a constellation defined by QAM symbols. The number |
%| of QAM symbols on this constellation is determined by M^2. |
%| |
%+----------------------------------------------------------------+
function[symbols] = qammod(in_binary, carrier_count, M)
% M^2 = number of points on constellation.
% in_binary(64,M) 64 derived from IFFT size
% in_binary is made from the S/P
%=================== Generate QAM Alphabet =========================
temp_M = -(M-1):2:(M-1);
for i=1:M
for k = 1:M
QAM(i,k) = temp_M(i) + j*temp_M(k);
end
end
QAM = QAM(:).';
%================= Binary to Decimal and assign Symbol ==============
symbols = zeros(carrier_count, 1);
index = 1;
for row=1:carrier_count
index = 1;
for bit_position=1:M
index = index + ((2^(bit_position-1)) * in_binary(row,bit_position));
% index is a number from 1-16
end
symbols(row) = QAM(index);
end
%====================== End File ====================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -