Skip to Main Content Skip to Search
Product Documentation

Constellation Visualization

Some linear modulator blocks provide the capability to visualize a signal constellation right from the block mask. This Constellation Visualization feature allows you to visualize a signal constellation for specific block parameters. The following blocks support constellation visualization:

Clicking View Constellation on a linear modulator block mask, plots the signal constellation using the block's mask parameters. If you set a modulator block to output single or fixed-point data types, clicking View Constellation generates two signal constellations plots overlaid on each other.

The title of the plot indicates the values of significant parameters. You can use the full array of MATLAB plot tools to manipulate plot figures. Selecting Inherit via back propagation for the Output Data Type generates a constellation plot with double as the Output data type.

Observe How Modulator Design Changes Affect a Signal Constellation

In this tutorial, you will make changes to the modulator block. Without actually applying the changes to the model, you will observe how these changes effect the signal constellation.

  1. Open the constellation visualization tutorial constellation visualization tutorial model by typing doc_CVTutorialModel at the MATLAB command line.

  2. Double-click the Rectangular QAM Modulator Baseband block.

  3. Next, click View Constellation

    The constellation plot shows that the constellation:

    • Uses a 16-QAM modulation scheme

    • Uses Binary constellation mapping

    • Has 0 degree phase offset

    • Has a minimum distance between two constellation points of 2

    The constellation plot also shows that the signal has a double precision data type. Because the Input type is integer, the constellation has integer symbol mapping.

  4. From the block mask, select Bit for the Input type parameter.

  5. Select Gray for the Constellation ordering parameter.

  6. Click View Constellation, and observe the results. Even though you did not click Apply, making these changes part of the model, the constellation plot still updates. The plot indicates gray constellation ordering using a bit representation of symbols.

  7. You can overlay and compare the effect that two different data type selections have on a signal constellation. For example, you can compare the effect of changing Output data type from double to Fixed-point on the signal constellation.

    To compare settings, perform the following tasks:

    • Click the Data Types tab.

    • Set the Output data type parameter to Fixed-point.

    • Set the Output word length parameter to 16.

    • Set the Set Output fraction length to parameter to Best precision.

  8. Click Main tab, and then click View Constellation.

    The plot overlays the fixed-point constellation on top of the double-precision constellation.

  9. You can specify a block parameter value using variables defined in the MATLAB workspace. To define a variable, type M=32 in the MATLAB workspace.

      Note   The model workspace in Simulink has priority over the base workspace in MATLAB.

  10. In the block mask, click the Main tab, and then type M for the M-ary number parameter. This parameter allows the block to use the variable value you defined in MATLAB workspace.

  11. Click the Data Types tab and then select double for the Output data type parameter.

  12. Click the Main tab. Then, click the View Constellation button and observe the results.

  13. You can also use the Constellation Visualization feature while a simulation is running. Type M=16 in the MATLAB workspace, select Integer for the Input type and click Apply.

  14. Simulate the model by clicking Start in the Simulink model window.

  15. While the simulation is running, click View Constellation. Compare the signal constellation to the scatter plot generated in the previous step.

  16. End the simulation by clicking the Stop button in the Simulink model window.

    The Constellation Visualization feature provides full access to the MATLAB plotting capabilities, including: capturing a figure, saving a figure in multiple file formats, changing display settings, or saving files for archiving purposes. To capture a figure, select Edit > Copy Figure.

    Using this tutorial, you have generated numerous constellation plots. If you close the Simulink model or delete the modulator block from the model, all the plots will close.

      Tip   If you capture a figure you want to archive for future use, save the figure before closing the model.

  17. Close the Simulink model, and observe that all of the constellation figures also close.

Plot Signal Constellations

To plot the signal constellation associated with a modulation process, follow these steps:

  1. 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.

  2. 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.

  3. Apply the scatterplot function to the modulated output to create a plot.

Examples of Signal Constellation Plots

The following examples produce plots of signal constellations:

The reference entry for the modnorm function provides additional examples.

Constellation for 16-PSK.  

The code below plots a PSK constellation having 16 points.

% Use 16-PSK modulation.
hMod = modem.pskmod(16);

% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,...
    'Constellation',hMod.Constellation);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = 'rd';
% Add symbol labels
hold on;
k=log2(hMod.M);
for jj=1:hMod.M
        text(real(hMod.Constellation(jj))-0.15,...,
        imag(hMod.Constellation(jj))+0.15,...
        dec2base(hMod.SymbolMapping(jj),2,k));
end
hold off;

Constellation for 32-QAM.  

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.

% Create 32-QAM modulator
hMod = modem.qammod(32);
% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,...
    'Constellation',hMod.Constellation);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = 'rd';
% Add symbol labels
hold on;
for jj=1:hMod.M
   text(real(hMod.Constellation(jj)),imag(hMod.Constellation(jj)),...
   [' ' num2str(hMod.SymbolMapping(jj))]);
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 you can verify visually that the constellation uses Gray coding.

% Create 8-QAM Gray encoded modulator
hMod = modem.qammod('M',8,'SymbolOrder','Gray');
% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,...
    'Constellation',hMod.Constellation);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = '.';
% Add symbol labels
hold on;
k=log2(hMod.M);
for jj=1:hMod.M
        text(real(hMod.Constellation(jj))+0.15,...,
        imag(hMod.Constellation(jj)),...
        dec2base(hMod.SymbolMapping(jj),2,k));
end
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 + 1i*quadr;

% Create a scatter plot
scatterPlot = commscope.ScatterPlot('SamplesPerSymbol',1,...
    'Constellation',const);
% Show constellation
scatterPlot.PlotSettings.Constellation = 'on';
scatterPlot.PlotSettings.ConstellationStyle = '*';
title('Customized Constellation for QAM');

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS