modulation.m
function output_modu = modulation(input_frame, index)
% Input_modu: input bit stream (0,1)
% index: modulation index
% 1---bpsk
% 2---qpsk
% 4---16qam
% 6---64qam
% else is error
f_length = length(input_frame)/index;
QAM_input_I = zeros(1,f_length);
QAM_input_Q = zeros(1,f_length);
% note: Matlab index starts from 1
switch index
case 1,
BPSK_I = [-1 1]; % refer to Table82 on page21 of IEEE802.11a
QAM_input_I = BPSK_I(input_frame+1);
output_modu = QAM_input_I ;
case 2,
QPSK_IQ = [-1 1]; % refer to Table83 on page21 of IEEE802.11a
QAM_input_I = QPSK_IQ(input_frame(1:2:end)+1);
QAM_input_Q = QPSK_IQ(input_frame(2:2:end)+1);
output_modu = QAM_input_I + j * QAM_input_Q;
case 3,