qammod

Syntax

y = qammod(x,M)
y = qammod(x,M,ini_phase)
y = qammod(x,M,ini_phase,symbol_order)

Description

y = qammod(x,M) outputs the complex envelope y of the modulation of the message signal x using quadrature amplitude modulation. M is the alphabet size and must be an integer power of 2. The message signal must consist of integers between 0 and M-1. The signal constellation is rectangular or cross-shaped, and the nearest pair of points in the constellation is separated by 2. If x is a matrix with multiple rows, the function processes the columns independently.

y = qammod(x,M,ini_phase) specifies the initial phase of the modulated signal in radians.

y = qammod(x,M,ini_phase,symbol_order) specifies how the function assigns binary words to corresponding integers. If symbol_order is set to 'bin' (default), the function uses a natural binary-coded ordering. If symbol_order is set to 'gray', it uses a Gray constellation ordering.

Examples

collapse all

Modulate Data using QAM

Modulate data using QAM and display the result in a scatter plot.

Set the modulation order to 16 and create a data vector containing each of the possible symbols.

M = 16;
x = (0:M-1)';

QAM modulate the data using the qammod function.

y = qammod(x,M);

Display the modulated signal constellation using the scatterplot function.

scatterplot(y)

Modulate the data with an initial phase of /4 and display its scatter plot. The constellation is shifted by 45 degrees.

y = qammod(x,M,pi/4);
scatterplot(y)

Set the modulation order to 256 and display the scatter plot of the modulated signal.

M = 256;
x = (0:M-1)';
y = qammod(x,M);
scatterplot(y)

Normalize QAM Signal by Average and Peak Power

QAM modulate random data symbols and normalize the modulator output by the average and peak power.

Set the modulation order and generate random data.

M = 64;
x = randi([0 M-1],1000,1);

Modulate the data.

y = qammod(x,M);

Determine the average and peak power for the modulated signal.

meanPower = mean(abs(y).^2);
peakPower = max(abs(y).^2);

Normalize the modulated signal, y, and plot the resulting constellations.

yAvg = y/sqrt(meanPower);
yPeak = y/sqrt(peakPower);

scatterplot(yAvg)
title('64-QAM, Average Power = 1 W')

scatterplot(yPeak)
title('64-QAM, Peak Power = 1 W')