comm.ConstellationDiagram System object

Package: comm

Display a constellation diagram for input signals

Description

The ConstellationDiagram System object™ plots constellation diagrams, plots signal trajectory, and provides the ability to perform EVM and MER measurements.

To plot constellation diagrams:

  1. Define and set up your constellation diagram object. See Construction.

  2. Call step to display a constellation diagram figure according to the properties of comm.ConstellationDiagram. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.ConstellationDiagram returns a System object, H, that displays real and complex-valued floating and fixed-point signals in the I/Q plane.

H = comm.ConstellationDiagram(Name,Value, ...) returns a Constellation Diagram System object, H, with each specified property Name set to the specified Value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

Properties

Name

Caption to display on Constellation Diagram window

Specify the caption that the Constellation Diagram window displays as a string. The default value of this property is Constellation Diagram. This property is tunable.

SamplesPerSymbol

Number of samples used to represent a symbol

Specify the number of samples that represent a symbol. The default value of this property is 1. When the SamplesPerSymbol property is greater than 1, the object downsamples and plots the input signal.

SampleOffset

Number of samples to skip before plotting points

Specify the number of samples to skip when decimating the input signal. The default value of this property is 0. This property is tunable. This value must be a nonnegative integer less than the number of samples per symbol.

SymbolsToDisplaySource

Specify the source of symbols to display as one of Input frame length | Property]. When you set the SymbolsToDisplaySource to Input frame length, the object calculates the number of symbols to display as the input frame length divided by the value of the SamplesPerSymbol property. When you set this property to Property, the maximum number of symbols to display is the value of the SymbolsToDisplay property. The default is Input frame length. This property is tunable.

SymbolsToDisplay

The maximum number of symbols that can be displayed when input signal is long.

This property is applicable when you set the SymbolsToDisplaySource property to Property. Always plot the latest SymbolsToDisplay symbols. The default value of this property is 256. This property is tunable.

ReferenceConstellation

The ideal constellation of the input signal

The object can display the ReferenceConstellation with its own marker. To obtain the signal quality measurement, you must set the ReferenceConstellation property to a valid value. The default value of this property is [0.7071+0.7071i -0.7071+0.7071i -0.7071-0.7071i 0.7070-0.7071i]. This property is tunable.

ReferenceMarker

Specify the marker for reference display

The default value of this property is '+'. This property is tunable.

ReferenceColor

Specify the color for reference display constellation

The default value of this property is [1 0 0] (red). This property is tunable.

ShowReferenceConstellation

Option to turn on the reference constellation

Set this property to true to show reference constellation on the display. The default value of this property is true. This property is tunable.

ShowTrajectory

Option to turn on the signal trajectory plot.

Set this property to true to display a plot of the signal trajectory. The signal trajectory is a plot of the in-phase component versus the quadrature component of a modulated signal. The default value of this property is false. This property is tunable.

Position

Scope window position in pixels

Specify the size and location of the scope window in pixels, as a four-element double vector of the form: [left bottom width height]. The default value of this property is dependent on the screen resolution, and is such that the window is positioned in the center of the screen, with a width and height of 410 and 300 pixels respectively. This property is tunable.

ShowGrid

Option to turn on grid

Set this property to true to turn on the grid or false to turn off the grid. The default value of this property is true. This property is tunable.

ShowLegend

Option to turn on legend

Set this property to true to turn on the legend. The default is false. This property is tunable.

ColorFading

Option to add color fading effect

When you set this property to true, the points in the display fade as the interval of time after they are first plotted increases. This is for animation that resembles an oscilloscope. The default value of this property is false. This property is tunable.

Title

Display title

Specify the display title as a string. The default value of this property is an empty string. This property is tunable.

XLimits

X-axis limits

Specify the x-axis limits as a two-element numeric vector: [xmin xmax]. The default value of this property is [-1.375 1.375]. This property is tunable.

YLimits

Y-axis limits

Specify the y-axis limits as a two-element numeric vector: [ymin ymax]. The default value of this property is [-1.375 1.375]. This property is tunable

XLabel

X-axis label

Specify the x-axis label as a string. The default value of this property is In-phase Amplitude. This property is tunable.

YLabel

Y-axis label

Specify the y-axis label as a string. The default value of this property is Quadrature Amplitude. This property is tunable.

MeasurementInterval

The measurement interval

When the input signal contains one sample per symbol and the reference constellation is provided, this System object can measure the signal quality in terms of EVM and MER. The measurement panel can be evoked by clicking on the Signal Quality button. This property specifies the window length for the measurement. The value of this property must be greater than one and less than or equal to the value of SymbolesToDisplay property. If the number of data input is less than MeasurementInterval, it will wait for more data before measurement can be calculated. The default value of this property is 2. This property is tunable.

EVMNormalization

EVM normalization

Specify the normalization method that the object uses in the EVM calculation as one of Average constellation power or Peak constellation power. The default value of this property is Average constellation power. This property is tunable.

Methods

cloneCreate scope object with same property values
hideHide scope window
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of the scope object
showMake scope window visible
stepDisplay constellation diagram of signal in scope figure

Examples

expand all

Plot 16-QAM Constellation

This example shows how to create a 16-QAM modulator, transmit data using an AWGN channel, and plot the signal constellation.

Create a Rectangular QAM Modulator System object, hMod, and set the modulation order to 16. Find the constellation reference points using the constellation function.

hMod = comm.RectangularQAMModulator('ModulationOrder',16);
refC = constellation(hMod);

Create an AWGN channel while specifying the noise level using the signal-to-noise ratio method.

hAWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)', ...
    'SNR',15);

Create a constellation diagram System object and specify the constellation reference points and axes limits using name-value pairs.

hScope = comm.ConstellationDiagram('ReferenceConstellation',refC, ...
    'XLimits',[-4 4],'YLimits',[-4 4]);

Generate random, 16-ary data symbols.

d = randi([0 15],1000,1);

Apply 16-QAM modulation.

sym = step(hMod,d);

Pass the modulated signal through the AWGN channel.

rcv = step(hAWGN,sym);

Display the constellation diagram.

step(hScope,rcv)

Plot Amplitude Imbalanced QPSK Constellation

This example shows how to modulate random data symbols, apply an amplitude imbalance, pass the signal through a noisy channel, and plot the resultant constellation.

Create a QPSK modulator object.

hMod = comm.QPSKModulator;

Create a constellation diagram object. Because the default reference constellation for the comm.ConstellationDiagram System object is QPSK, it is not necessary to set additional properties.

hScope = comm.ConstellationDiagram;

Create an AWGN channel.

hAWGN = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (Es/No)', ...
    'EsNo',20);

Generate random data symbols and apply QPSK modulation.

data = randi([0 3],1000,1);
modData = step(hMod,data);

Apply an I/Q amplitude imbalance to the modulated signal.

ampImb = 10; % dB
txReal = exp(0.5*ampImb/20)*real(modData);
txImag = exp(-0.5*ampImb/20)*imag(modData);
txSig = complex(txReal,txImag);

Pass the transmitted signal through the AWGN channel and display the constellation diagram. Observe that the data points have shifted from their ideal locations.

rxSig = step(hAWGN,txSig);
step(hScope,rxSig)

Signal Display

To change the signal display settings, select View > Configuration Properties to bring up the Visuals—Constellation Properties dialog box. Then, modify the values for the Samples per symbol, Offset, Symbols to display and Reference Constellation parameters on the Main tab.

To communicate simulation data that corresponds to the current display, the scope uses the Frames indicator on the scope window. The following figure highlights important aspects of the Constellation Diagram window.

Toolbar

Axes Control Buttons

Tools >
Zoom In

N/A

When this tool is active, you can zoom in on the scope window. To do so, click in the center of your area of interest, or click and drag your cursor to draw a rectangular area of interest inside the scope window.

Tools >
Zoom X

N/A

When this tool is active, you can zoom in on the x-axis. To do so, click inside the scope window, or click and drag your cursor along the x-axis over your area of interest.

Tools >
Zoom Y

N/A

When this tool is active, you can zoom in on the y-axis. To do so, click inside the scope window, or click and drag your cursor along the y-axis over your area of interest.

Tools >
Pan

N/A

When this tool is active, you can pan on the scope window. To do so, click in the center of your area of interest and drag your cursor to the left, right, up, or down, to move the position of the display.

Tools >
Scale Axes Limits
Ctrl+A

Click this button to scale the axes in the active scope window.

Alternatively, you can enable automatic axes scaling by selecting one of the following options from the Tools menu:

  • Automatically Scale Axes Limits — When you select this option, the scope scales the axes as needed during simulation.

  • Scale Axes Limits after 10 Updates — When you select this option, the scope scales the axes after 10 updates.

  • Scale Axes Limits at Stop — When you select this option, the scope scales the axes each time the simulation is stopped.

Tools >
Measurements
>
Signal Quality

N/A

Click this button to display Error Vector Measurement (EVM) and Modulation Error Ratio (MER) measurement results.

View >
Configuration Properties

N/A

Show the signal trajectory of a modulated signal. You can view the signal trajectory by using the Show Signal Trajectory button on the toolbar or by opening the display pane in the constellation properties dialog and enabling the Show signal trajectory option.

Measurements Panels

Measurements Panel Buttons

Each of the Measurements panels contains the following buttons that enable you to modify the appearance of the current panel.

ButtonDescription

Move the current panel to the top. When you are displaying more than one panel, this action moves the current panel above all the other panels.

Collapse the current panel. When you first enable a panel, by default, it displays one or more of its panes. Click this button to hide all of its panes to conserve space. After you click this button, it becomes the expand button .

Expand the current panel. This button appears after you click the collapse button to hide the panes in the current panel. Click this button to display the panes in the current panel and show measurements again. After you click this button, it becomes the collapse button again.

Undock the current panel. This button lets you move the current panel into a separate window that can be relocated anywhere on your screen. After you click this button, it becomes the dock button in the new window.

Dock the current panel. This button appears only after you click the undock button. Click this button to put the current panel back into the right side of the Scope window. After you click this button, it becomes the undock button again.

Close the current panel. This button lets you remove the current panel from the right side of the Scope window.

Some panels have their measurements separated by category into a number of panes. Click the pane expand button to show each pane that is hidden in the current panel. Click the pane collapse button to hide each pane that is shown in the current panel.

Settings Pane

The Settings pane enables you to define the measurement interval and normalization method the scope uses when obtaining signal measurements.

  • Measurement interval — Specify the duration of the EVM or MER measurement. For more information see MeasurementInterval.

  • EVM normalization — For the EVM calculations, you may use one of two normalization methods: average constellation power or peak constellation power. The scope performs EVM calculations using the comm.EVM System object. For more information, see comm.EVM.

Signal Quality Panel

The Signal Quality panel displays Error Vector Measurement (EVM) and Modulation Error Ratio (MER) measurement results.

You can choose to hide or display the Signal Quality panel. In the Scope menu, select Tools > Measurements > Signal Quality.

Signal Quality Pane

The Signal Quality pane displays the calculation results.

  • EVM — An error vector is a vector in the I-Q plane between the ideal constellation point and the actual point at the receiver. EVM is measured in two formats: root mean square (RMS) or normalized Peak. Typically, EVM is reported in decibels. For more information, see comm.EVM.

  • MER — MER is the ratio of the average power of the error vector and the average power of the transmitted signal. The scope indicates the measurement result in decibels. For more information, see comm.MER.

Visuals — Constellation Properties

Main Pane

Samples per symbol

Number of samples used to represent a symbol. This value must be a positive number.

Offset (samples)

Number of samples to skip before plotting points. The offset must be a nonnegative integer value less than the value of the samples per symbol.

Symbols to display

The maximum number of symbols that can be displayed. Must be a positive integer value.

Reference constellation

The ideal constellation of the input signal. When the Measurements tool is on, the reference constellation is used to detect the ideal signal input. Therefore, this property cannot be empty when the Measurements tool is on. (When the Measurements tool is not on, this property can be empty.)

Display Pane

Show grid

Select this check box to turn on the grid.

Show legend

Select this check box to display a legend for the graph.

Color fading

When you set select this check box, the points in the display fade as the interval of time after they are first plotted increases. The default value of this property is false. This property is tunable.

Show signal trajectory

Select this check box to display the trajectory of a modulated signal by plotting its in-phase component versus its quadrature component.

Show reference constellation

Select this check box to display the points comprising the reference constellation.

Reference marker

Select the symbol that represents the points on the reference constellation.

Reference color

Select the color of the points on the reference constellation. Refer to the following table for the binary values and their corresponding colors.

ColorBinary Code
Black000
Blue001
Green010
Cyan011
Red100
Magenta101
White111

X-limits (Minimum)

Specify the minimum value of the x-axis.

X-limits (Maximum)

Specify the maximum value of the x-axis.

Y-limits (Minimum)

Specify the minimum value of the y-axis.

Y-limits (Maximum)

Specify the maximum value of the y-axis.

Title

Specify a label that appears above the constellation diagram plot. By default, there is no title.

X-axis label

Specify the text the scope displays along the x-axis

Y-axis label

Specify the text the scope displays along the y-axis

Style Dialog Box

In the Style dialog box, you can customize the style of displays. You are able to change the color of the figure containing the displays, the background and foreground colors of display axes, and properties of lines in a display. From the scope menu, select View > Style to open this dialog box.

Properties

The Style dialog box allows you to modify the following properties of the scope figure:

Figure color

Specify the color that you want to apply to the background of the scope figure. By default, the figure color is gray.

Axes colors

Specify the color that you want to apply to the background of the axes for the active display.

Line

Specify the line style, line width, and line color for the selected signal on the active display. The Line property is always set to no line when the signal trajectory plot is disabled.

Marker

Specify marks for the selected signal on the active display to show at data points. This parameter is similar to the Marker property for the MATLAB® Handle Graphics® plot objects. You can choose any of the marker symbols from the following table. The Marker property cannot be set to No marker unless the signal trajectory plot is enabled.

SpecifierMarker Type
noneNo marker
Circle
Square
Cross
Point (default)
Plus sign
Asterisk
Diamond
Downward-pointing triangle
Upward-pointing triangle
Left-pointing triangle
Right-pointing triangle
Five-pointed star (pentagram)
Six-pointed star (hexagram)

Tools: Plot Navigation Properties

Properties

The Tools—Axes Scaling Properties dialog box appears as follows.

Axes scaling

Specify when the scope should automatically scale the axes. You can select one of the following options:

  • Manual — When you select this option, the scope does not automatically scale the axes. You can manually scale the axes in any of the following ways:

    • Select Tools > Axes Scaling Properties.

    • Press one of the Scale Axis Limits toolbar buttons.

    • When the scope figure is the active window, press Ctrl and A simultaneously.

  • Auto — When you select this option, the scope scales the axes as needed, both during and after simulation. Selecting this option shows the Do not allow Y-axis limits to shrink check box.

  • After N Updates — Selecting this option causes the scope to scale the axes after a specified number of updates. Selecting this option shows the Number of updates edit box.

By default, this property is set to Auto. This property is Tunable.

Do not allow Y-axis limits to shrink

When you select this property, the y-axis is allowed only to grow during axes scaling operations. If you clear this check box, the y-axis or color limits may shrink during axes scaling operations.

This property appears only when you select Auto for the Axis scaling property. When you set the Axes scaling property to Manual or After N Updates, the y-axis or color limits are allowed to shrink. Tunable.

Number of updates

Specify as a positive integer the number of updates after which to scale the axes. This property appears only when you select After N Updates for the Axes scaling property. Tunable.

Scale axes limits at stop

Select this check box to scale the axes when the simulation stops. The y-axis is always scaled. The x-axis limits are only scaled if you also select the Scale X-axis limits check box.

Y-axis Data range (%)

Set the percentage of the y-axis that the scope should use to display the data when scaling the axes. Valid values are between 1 and 100. For example, if you set this property to 100, the Scope scales the y-axis limits such that your data uses the entire y-axis range. If you then set this property to 30, the scope increases the y-axis range such that your data uses only 30% of the y-axis range. Tunable.

Y-axis Align

Specify where the scope should align your data with respect to the y-axis when it scales the axes. You can select Top, Center, or Bottom. Tunable.

Autoscale X-axis limits

Check this box to allow the scope to scale the x-axis limits when it scales the axes. If Axes scaling is set to Auto, checking Scale X-axis limits only scales the data currently within the axes, not the entire signal in the data buffer. Tunable.

X-axis Data range (%)

Set the percentage of the x-axis that the Scope should use to display the data when scaling the axes. Valid values are between 1 and 100. For example, if you set this property to 100, the Scope scales the x-axis limits such that your data uses the entirex-axis range. If you then set this property to 30, the Scope increases the x-axis range such that your data uses only 30% of the x-axis range. Use the x-axis Align property to specify data placement with respect to the x-axis.

This property appears only when you select the Scale X-axis limits check box. Tunable.

X-axis Align

Specify how the Scope should align your data with respect to the x-axis: Left, Center, or Right. This property appears only when you select the Scale X-axis limits check box. Tunable.

Was this topic helpful?