Documentation

This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

comm.ConstellationDiagram System object

Display constellation diagram for input signals

Description

The `comm.ConstellationDiagram` System object™ displays real and complex-valued floating and fixed-point signals in the IQ plane. Use this System object to perform qualitative and quantitative analysis on modulated single-carrier signals.

In the constellation diagram window you can:

• Choose which channels are displayed by selecting signals in the legend. Use `ShowLegend` to display the legend. To create a multichannel signal, specify the input as a matrix with individual signals defined in the columns of the matrix.

• Display the EVM / MER Measurements panel, which displays calculated error vector magnitude (EVM) and modulation error ratio (MER) measurements. When a multichannel signal is input to a `comm.ConstellationDiagram` System object, use the Trace Selection pane to choose the signal being measured.

To display constellation diagrams:

1. Create the `comm.ConstellationDiagram` object and set its properties.

2. Call the object with arguments, as if it were a function.

Creation

Syntax

``constdiag = comm.ConstellationDiagram``
``constdiag = comm.ConstellationDiagram(Name,Value)``

Description

example

````constdiag = comm.ConstellationDiagram` returns a `comm.ConstellationDiagram` System object that displays real and complex-valued floating and fixed-point signals in the IQ plane.```

example

````constdiag = comm.ConstellationDiagram(Name,Value)` set the properties of the System object using one or more name-value pair arguments in any order as (`Name1`,`Value1`,...,`NameN`,`ValueN`). ```
Example: `constdiag = comm.ConstellationDiagram('SampleOffset',1e3)` specifies that the first `1000` samples received will not be displayed.

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the `release` function unlocks them.

If a property is tunable, you can change its value at any time.

Title of the Constellation Diagram window, specified as a character vector.

Number of samples used to represent each symbol, specified as a positive integer. When the `SamplesPerSymbol` property is greater than 1, the signal is downsampled before it is plotted.

Tunable: Yes

Number of samples to skip before plotting points, specified as a nonnegative integer less than SamplesPerSymbol. This property specifies the number of samples to skip when downsampling the input signal.

Tunable: Yes

Source of symbols to display, specified as:

• `'Input frame length'` — The number of symbols to display is equal to the input frame length divided by SamplesPerSymbol.

• `'Property'`SymbolsToDisplay specifies the maximum number of symbols to display.

Tunable: Yes

Maximum number of symbols to display, specified as a positive integer. Use `SymbolsToDisplay` to limit the maximum number of symbols displayed when long signals are input. Symbols plotted are the most recent symbols received.

Tunable: Yes

Dependencies

This property applies when SymbolsToDisplaySource is set to `'Property'`.

Ideal constellation of the input signal, specified as a row vector defining the ideal constellation points. To obtain the EVM / MER Measurements, you must set the `ReferenceConstellation` property to a valid value.

Tunable: Yes

Data Types: `double`
Complex Number Support: Yes

Specify the marker for reference display. For a list of marker options, see Supported Marker Symbols (MATLAB).

Tunable: Yes

Dependencies

This property applies when a ReferenceConstellation is specified.

Color for reference display constellation, specified as a three element row vector indicating RGB (red, green, blue) component colors.

Display the reference constellation, specified as `true` or `false`.

Tunable: Yes

Data Types: `logical`

Turn on signal trajectory plot, specified as `false` or `true`. The signal trajectory is a plot of the in-phase component versus the quadrature component of a modulated signal. See the Show Signal Trajectory button on the toolbar in the Signal Display.

Tunable: Yes

Data Types: `logical`

Scope window position and size in pixels, specified as a four-element vector of the form [left bottom width height]. The first two elements in the vector indicate the location of the lower left corner and the last two specify the size of the window. The default value for the location depends on the screen resolution. By default, the window is positioned in the center of the screen with a width and height of 410 and 300 pixels, respectively.

Tunable: Yes

Data Types: `double`

Turn on the grid, specified as `true` or `false`.

Tunable: Yes

Data Types: `logical`

Names for input channels, specified as a cell array of strings or character vectors. If you do not specify names, the channels are labeled as `Channel 1`, `Channel 2`, etc.

The names assigned to input channels appear in the legend and the Measurements > Trace Selection pane.

To show the legend, set ShowLegend to `true`. The legend displays after you provide an input signal to the comm.ConstellationDiagram System object.

To show the Trace Selection pane, select Tools > Measurements > Trace Selection. To enable the Trace Selection pane, you must first provide an input signal to the comm.ConstellationDiagram System object.

Example: ```constDiag = comm.ConstellationDiagram('ChannelNames',{'8-QAM','8-PSK'})``` assigns names for two input channels to `8-QAM` and `8-PSK`.

Tunable: Yes

Display the legend, specified as `false` or `true`. The names listed in the legend are the signal names specified by the ChannelNames property.

From the legend, you can control which signals to plot. In the scope legend, click a signal name to hide the signal in the scope. To show the signal, click the signal name again. To show only one signal and hide all other signals, right-click the signal name. To show all signals, press Esc.

Tunable: Yes

Data Types: `logical`

Add color fading effect, specified as `false` or `true`. 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 animation resembles an oscilloscope display.

Data Types: `logical`

Plot title, specified as a character vector or string.

Tunable: Yes

x-axis limits, specified as a two-element numeric vector of the form [xmin xmax].

Tunable: Yes

y-axis limits, specified as a two-element numeric vector of the form [ymin ymax].

Tunable: Yes

x-axis label, specified as a character vector or string.

Tunable: Yes

y-axis label, specified as a character vector or string.

Tunable: Yes

Display measurements pane, specified as `false` or `true`. To compute and display EVM or MER measurements, activate this pane.

Tunable: Yes

Data Types: `logical`

Measurement interval, specified as `'Current Display'`, `'All displays'`, or a positive integer in the range [`2` SymbolsToDisplay]. This property specifies the window length for the EVM and MER measurements.

When the input signal contains one sample per symbol and the reference constellation is provided, the constellation diagram display can measure the signal quality in terms of EVM and MER. The EVM / MER Measurements pane can be displayed by clicking the Signal Quality button. See the toolbar in the Signal Display. After the number of input data samples is greater than MeasurementInterval, the EVM and MER measurements are computed.

Tunable: Yes

EVM normalization method, specified as ```'Average constellation power'``` or `'Peak constellation power'`. For more information, see EVM / MER Measurements.

Tunable: Yes

Usage

For versions earlier than R2016b, use the `step` function to run the System object algorithm. The arguments to `step` are the object you created, followed by the arguments shown in this section.

For example, `y = step(obj,x)` and `y = obj(x)` perform equivalent operations.

Syntax

``constdiag(signal)``

Description

example

````constdiag(signal)` opens a Constellation Diagram window and displays `signal`.```

Input Arguments

expand all

Input signal to plot, specified as a column vector or matrix. To create a multichannel signal, specify a matrix with individual signals defined in the columns of the matrix.

Example: `signal = [sig1 sig2]` concatenates two column vectors of length N to make an N-by-2 matrix input signal.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named `obj`, use this syntax:

`release(obj)`

expand all

 `show` Show scope window `hide` Hide scope window `isVisible` Determine visibility of scope window
 `step` Run System object algorithm `release` Release resources and allow changes to System object property values and input characteristics `reset` Reset internal states of System object

Examples

expand all

QPSK modulate random data symbols and apply an amplitude imbalance to the signal. Pass the signal through a noisy channel. Plot the resultant constellation.

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.

`constDiagram = comm.ConstellationDiagram;`

Generate random data symbols and apply QPSK modulation.

```data = randi([0 3],1000,1); modData = pskmod(data,4,pi/4);```

Apply an amplitude imbalance to the modulated signal.

`txSig = iqimbal(modData,5);`

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

```rxSig = awgn(txSig,20); constDiagram(rxSig)```

Apply 16-QAM modulation, transmit data using an AWGN channel, and plot the signal constellation.

Create a 16-QAM reference constellation.

```M = 16; refC = qammod(0:M-1,M);```

Create a `comm.ConstellationDiagram` System object. Specify the constellation reference points and axes limits using name-value pairs.

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

Generate random, 16-ary data symbols.

`data = randi([0 M-1],1000,1);`

Apply 16-QAM modulation.

`sym = qammod(data,M);`

Pass the modulated signal through an AWGN channel.

`rcv = awgn(sym,15);`

Display the constellation diagram.

`constDiagram(rcv)`

Plot 8-PSK and 8-QAM signals in the same scope.

Define a 8-PSK reference constellation and the number of samples per symbol.

```M= 8; refConst = pskmod(0:M-1,M); sps = 8;```

Create a `comm.ConstellationDiagram` System object™.

```constDiag = comm.ConstellationDiagram('SamplesPerSymbol',sps, ... 'ReferenceConstellation',refConst,'ShowLegend',true, ... 'XLimits',[-4 4],'YLimits',[-4 4], ... 'ChannelNames',{'8-QAM','8-PSK'});```

Create an eight-tap `comm.RaisedCosineTransmitFilter` object that scales the signal gain by the number of samples per symbol.

```txfilt = comm.RaisedCosineTransmitFilter('Shape','Normal', ... 'OutputSamplesPerSymbol',constDiag.SamplesPerSymbol, ... 'FilterSpanInSymbols',8,'RolloffFactor',0.5, ... 'Gain',sqrt(sps));```

Generate random data symbols, modulate the symbols, and apply raised cosine filtering. Add AWGN with two different SNRs to yield two received signals.

```d = randi([0 M-1],4000,1); symqam = qammod(d,M); xmtqam = txfilt(symqam); rcvqam = awgn(xmtqam,20); sympsk = pskmod(d,M); xmtpsk = txfilt(sympsk); rcvpsk = awgn(xmtpsk,20);```

Create a multichannel signal by concatenating the two received signals. View the multichannel signal with the constellation diagram object.

```rcvsig = [rcvqam rcvpsk]; constDiag(rcvsig);```

expand all

Tips

• If you want any of these features, use a `comm.ConstellationDiagram` System object.

• Measurements

• Basic reference constellations

• Signal trajectory plots

• Maintaining state between calls

• If you want a simple signal constellation snapshot, use the `scatterplot` function.