📄 modulation.m
字号:
function [Symbols] = Modulation(TxBits, ModScheme)
% This function Gray encodes binary bits into QPSK symbols onto antenna.
%
% function [Symbols] = Modulation(TxBits, ModScheme)
%
% Input:
% TxBits -- Transmit bits
% ModScheme -- Modulation type
% Output:
% Symbols -- Modulated symbols
% Note:
% Unit energy symbol constellation
% See also:
% None
% Description:
% Author(s): Wang Dongming, SEU, NCRL
j=sqrt(-1);
% Gray coded 16-QAM mapping vector
MapMatrix16QAM = [-1-j -1-3*j -1+j -1+3*j -3-j -3-3*j -3+j -3+3*j 1-j 1-3*j 1+j 1+3*j 3-j 3-3*j 3+j 3+3*j];
MapMatrix16QAM = MapMatrix16QAM/sqrt(10);
% Binary to Decimal order vector
vecOrder = (2.^(ModScheme-1:-1:0)).';
switch ModScheme
case 1
Symbols = TxBits*2 - 1;
case 2
Symbols = ((TxBits(:,1:2:end)*2 - 1) + j*(TxBits(:,2:2:end)*2 - 1))/sqrt(2);
case 4
matTxBits = vec2mat(TxBits,ModScheme);
vecTxBits = matTxBits * vecOrder + 1;
Symbols = MapMatrix16QAM(vecTxBits);
otherwise
disp('Modulation options out of range');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -