One of the best-performing modulation techniques is QAM [↗]. Here, we modulate the symbols by varying the carrier signal's amplitude and phase in response to the variation in the message signal (or voltage variation). So, we may say that QAM is a combination of phase and amplitude modulation. Additionally, it performs better than ASK or PSK [↗]. In fact, any constellation for any type of modulation, signal set (or, symbols) is structured in a way that prevents them from interacting further by being distinct by phase, amplitude, or frequency.
MATLAB Script
% This is an example of 4-QAM. Here constellation size is 4
% or total number of symbols/signals is 4
% We need 2 bits once to represent four constellation points
% QAM modulation is the combination of Amplitude modulation plus
% Phase Modulation. We map the decimal value of the input symbols, i.e.,
% 00, 01, 10, 11 to 1 + 1i, -1 + 1i, 1 - 1i, and -1 - 1i, respectively.
clc;clear all;close all;
M = 4; % Number of levels after quantization / size of signal constellation
k = log2(M); % Number of bits per symbol
rng(10) %assaining the value of seed integer
N =10000; % Number of bits to process
InputBits = randi([0 1],1,N); % Generating randon bits
InputSymbol_matrix = reshape(InputBits,length(InputBits)/k,k); % Reshape data into binary k-tuples, k = log2(M)
InputSymbols_decimal = bi2de(InputSymbol_matrix); % Convert binary to decimal
for n= 1:N/k
if InputSymbols_decimal(n)==0
QAM(n)= complex(1,1);
elseif InputSymbols_decimal(n)==1
QAM(n)= complex(-1,1);
elseif InputSymbols_decimal(n)==2
QAM(n)= complex(1,-1);
else
QAM(n)= complex(-1,-1);
end
end
%Transmission of 4QAM data over AWGN channel
snrdB = 10;
Y=awgn(QAM,snrdB); %received signal
%Threshold Detection
for n= 1:N/k
if (real(Y(n))>0 && imag(Y(n))>0)
Z(n)=complex(1,1);
elseif (real(Y(n))>0 && imag(Y(n))<0)
Z(n)=complex(1,-1);
elseif (real(Y(n))<0 && imag(Y(n))>0)
Z(n)=complex(-1,1);
else
Z(n)=complex(-1,-1);
end
end
figure(1)
scatter(real(QAM), imag(QAM))
xlim([-3, 3]);
ylim([-3, 3]);
legend('Transmitted Symbols')
figure(2)
scatter(real(Y), imag(Y))
xlim([-3, 3]);
ylim([-3, 3]);
legend('Received Symbols')