| Communications Toolbox | ![]() |
To plot the signal constellation associated with a modulation process, follow these steps:
If the alphabet size for the modulation process is M, then create the signal [0:M-1]. This signal represents all possible inputs to the modulator.
Use the appropriate modulation function to modulate this signal. If desired, scale the output. The result is the set of all points of the signal constellation.
Apply the scatterplot function to the modulated output to create a plot.
The following examples produce plots of signal constellations:
The reference entries for the modnorm and genqammod functions provide additional examples.
The code below plots a PSK constellation having 16 points.
M = 16; x = [0:M-1]; scatterplot(pskmod(x,M));

The code below plots a QAM constellation having 32 points and a peak power of 1 watt. The example also illustrates how to label the plot with the numbers that form the input to the modulator.
M = 32; x = [0:M-1]; y = qammod(x,M); scale = modnorm(y,'peakpow',1); y = scale*y; % Scale the constellation. scatterplot(y); % Plot the scaled constellation. % Include text annotations that number the points. hold on; % Make sure the annotations go in the same figure. for jj=1:length(y) text(real(y(jj)),imag(y(jj)),[' ' num2str(jj-1)]); end hold off;

Gray-Coded Signal Constellation.
The example below plots an 8–QAM signal Gray-coded constellation, labeling the points using binary numbers so that you can verify visually that the constellation uses Gray coding.
M = 8;
x = [0:M-1];
y = qammod(x,M,[],'gray');
% Plot the Gray-coded constellation.
scatterplot(y,1,0,'b.'); % Dots for points.
% Include text annotations that number the points in binary.
hold on; % Make sure the annotations go in the same figure.
annot = dec2bin([0:length(y)-1],log2(M));
text(real(y)+0.15,imag(y),annot);
axis([-4 4 -4 4]);
title('Constellation for Gray-Coded 8-QAM');
hold off;

Customized Constellation for QAM. The code below describes and plots a constellation with a customized structure.
% Describe constellation.
inphase = [1/2 -1/2 1 0 3/2 -3/2 1 -1];
quadr = [1 1 0 2 1 1 2 2];
inphase = [inphase; -inphase]; inphase = inphase(:);
quadr = [quadr; -quadr]; quadr = quadr(:);
const = inphase + j*quadr;
% Plot constellation.
scatterplot(const,1,0,'*');
hold on;
axis([-3 3 -3 3]);
title('Customized Constellation for QAM');
hold off;

| Examples of Digital Modulation and Demodulation | Selected Bibliography for Modulation | ![]() |
© 1994-2005 The MathWorks, Inc.