A scatter plot or constellation diagram is used to visualize the constellation of a digitally modulated signal.
To produce a scatter plot from a signal, use the
scatterplot function or use the
System object. A scatter
plot or constellation diagram can be useful when comparing system
performance to a published standard, such as 3GPP or DVB.
You create the
in two ways: using a default object or by defining name-value pairs.
For more information, see the
This example shows how to use constellation diagrams to view QPSK transmitted and received signals which are pulse shaped with a raised cosine filter.
Create a QPSK modulator.
qpsk = comm.QPSKModulator;
Create a raised cosine transmit filter with an upsample rate,
Rup, equal to 16.
Rup = 16; txfilter = comm.RaisedCosineTransmitFilter('Shape','Normal', ... 'RolloffFactor',0.5, ... 'FilterSpanInSymbols',10, ... 'OutputSamplesPerSymbol',Rup);
Generate data symbols and apply QPSK modulation.
data = randi([0 3],200,1); modData = qpsk(data);
Create a constellation diagram and set the
SamplesPerSymbol property to the upsampling rate of the signal. Specify the constellation diagram so that it only displays the last 100 samples. This hides the zero values output by the RRC filter for the first
constDiagram = comm.ConstellationDiagram('SamplesPerSymbol',Rup, ... 'SymbolsToDisplaySource','Property','SymbolsToDisplay',100);
Pass the modulated data through the raised cosine transmit filter.
txSig = txfilter(modData);
Display the constellation diagram of the transmitted signal.
To match the signal to its reference constellation, normalize the filter by setting its gain to the square root of the
OutputSamplesPerSymbol property. This was previously specified as
Rup. The filter gain is nontunable so the object must be released prior to changing this value.
release(txfilter) txfilter.Gain = sqrt(Rup);
Pass the modulated signal through the normalized filter.
txSig = txfilter(modData);
Display the constellation diagram of the normalized signal. The data points and reference constellation nearly overlap.
To view the transmitted signal more clearly, hide the reference constellation by setting the
ShowReferenceConstellation property to
constDiagram.ShowReferenceConstellation = false;
Create a noisy signal by Passing
txSig through an AWGN channel.
rxSig = awgn(txSig,20,'measured');
Show the reference constellation, and plot the received signal constellation.
constDiagram.ShowReferenceConstellation = true; constDiagram(rxSig)
This example simulates RF impairments for a signal that was
modulated using differential quaternary phase shift keying (DQPSK). Open the example model by
doc_receiverimpairments_dqpsk at the MATLAB® command
The model does the following:
Modulates a random signal using DQPSK modulation.
Applies impairments to the signal using the blocks from the RF Impairments library.
Forks the signal into two paths, and processes one path with an automatic gain control (AGC) to compensate for the free space path loss and the I/Q imbalance.
Displays the trajectory of the signal with AGC and the trajectory of the signal without AGC.
Demodulates both signals and calculates their error rates.
You can see the effect of the automatic gain by comparing the trajectories of the signals with and without AGC, as shown in the following figure.
Signal With (Left) and Without (Right) AGC
The trajectory of the signal with AGC more closely matches the undistorted trajectory for DQPSK, shown in the following figure, than does than the signal without AGC. Consequently, the error rate for the signal with AGC is much lower than the error rate for the signal without AGC.
In this example, the error rate for the demodulated signal without AGC is primarily caused by free space path loss and I/Q imbalance. The QPSK modulation minimizes the effects of the other impairments.