Main Content

Plot Signal Constellations

Create 16-PSK Constellation Diagram

Show reference constellation plots for 16-PSK modulation of Gray-coded and binary-coded symbol mapping by setting PlotConstellation=true when using the modulation function. Input bit signals and compare the bit patterns between the two constellations. The bit patterns in adjacent constellation points differ by only one bit for the Gray-coded symbol mapping but not for the binary-coded symbol mapping.

Set the parameters for 16-PSK modulation with no phase offset

M = 16;                   % Modulation alphabet size
bps = log2(M);            % Bits per symbol
phOffset = 0;             % Phase offset
bitdata = int2bit(0,bps); % Generate one symbol to modulate

Plot the reference constellation for Gray-coded symbols mapping. For the Gray-coded symbol mapping, the bit patterns in all adjacent constellation points differ by only one bit.

pskmod(bitdata,M,phOffset,InputType="bit",PlotConstellation=true);

Figure contains an axes object. The axes object with title 16-PSK, Gray Mapping, xlabel In-phase Amplitude, ylabel Quadrature Amplitude contains 19 objects of type line, text. One or more of the lines displays its values using only markers

Plot the reference constellation for binary-coded symbols mapping. For the binary-coded symbol mapping, the bit patterns in adjacent constellation points do not always differ by only one bit.

pskmod(bitdata,M,phOffset,"bin",InputType="bit",PlotConstellation=true);

Figure contains an axes object. The axes object with title 16-PSK, Binary Mapping, xlabel In-phase Amplitude, ylabel Quadrature Amplitude contains 19 objects of type line, text. One or more of the lines displays its values using only markers

Create 32-QAM Constellation Diagram

Plot a 32-QAM reference constellation by using the constellation plot capability of the modulation function, the comm.ConstellationDiagram System object™, and the scatterplot function.

Use the qammod function to generate the 32-QAM symbols with Gray-code symbol ordering and plot the reference constellation.

M = 32;
qammod(0,M,UnitAveragePower=true,PlotConstellation=true);

Figure contains an axes object. The axes object with title 32-QAM, Gray Mapping, UnitAveragePower=true, xlabel In-phase Amplitude, ylabel Quadrature Amplitude contains 35 objects of type line, text. One or more of the lines displays its values using only markers

Create a constellation diagram object with the reference constellation defined as 32-QAM. Plot the 32-QAM signal of reference constellation symbols.

refSym = [0:M-1]';
refC = qammod(refSym,M,UnitAveragePower=true);
cd = comm.ConstellationDiagram(ReferenceConstellation=refC);
cd(refC)

Plot the reference constellation with the scatterplot function and label the order of the constellation symbols.

scatterplot(refC,1,0,'r*');
for k = 1:M
    text(real(refC(k))+0.04,imag(refC(k))-0.04, ...
        num2str(refSym(k)),Color='r');
end
axis([-1.5 1.5 -1.5 1.5])

Figure Scatter Plot contains an axes object. The axes object with title Scatter plot, xlabel In-Phase, ylabel Quadrature contains 33 objects of type line, text. One or more of the lines displays its values using only markers This object represents Channel 1.

Create 8-QAM Gray Coded Constellation Diagram

Use the qammod function to generate the 8-QAM symbols with Gray symbol ordering. Note that Gray coding is the default symbol mapping for the qammod function.

M = 8;
data = 0:M-1;
sym = qammod(data,M);

Plot the constellation. Label the order of the constellation symbols.

scatterplot(sym,1,0,'r*');
grid on
for k = 1:M
    text(real(sym(k))-0.4,imag(sym(k))+0.4,num2str(data(k)),Color='r');
end
axis([-4 4 -2 2])

Figure Scatter Plot contains an axes object. The axes object with title Scatter plot, xlabel In-Phase, ylabel Quadrature contains 9 objects of type line, text. One or more of the lines displays its values using only markers This object represents Channel 1.

Plot a Triangular Constellation for QAM

Plot a customized QAM reference constellation by using a constellation diagram System object™.

Define the 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(:);
refConst = inphase + 1i*quadr;

Construct a constellation diagram object using name-value pairs to specify the title, the axes limits, the reference marker type, and the reference marker color.

constDiagram = comm.ConstellationDiagram( ...
    Title='Customized Constellation for QAM', ...
    XLimits=[-3 3], ...
    YLimits=[-3 3], ...
    ReferenceConstellation=refConst, ...
    ReferenceMarker='*', ...
    ReferenceColor=[0 1 0]);

Plot the customized constellation.

constDiagram(refConst)
release(constDiagram)

See Also