| Contents | Index |
A scatter plot of a signal shows the signal's value at a given decision point. In the best case, the decision point should be at the time when the eye of the signal's eye diagram is the most widely open.
To produce a scatter plot from a signal, use commscope.ScatterPlot.
Scatter plots are often used to visualize the signal constellation associated with digital modulation. For more information, see Plotting Signal Constellations. A scatter plot can be useful when comparing system performance to a published standard, such as 3GPP or DVB standards.
The scatter plot feature is part of the commscope package. Users can create the scatter plot object in two ways: using a default object or by defining parameter-value pairs. For more information, see the commscope.ScatterPlot help page.
In this example, you will observe the received signals for a QPSK modulated system. The output symbols are pulse shaped, using a raised cosine filter.
Create a PSK Modulator System object. Enter the following at the MATLAB command line:
hMod = comm.PSKModulator('ModulationOrder',4,'PhaseOffset',pi/4);Create an upsampling filter, with an upsample rate of 16. Type the following at the MATLAB command line:
Rup = 16; % up sampling rate hFilDesign = fdesign.pulseshaping(Rup,'Raised Cosine', ... 'Nsym,Beta',Rup,0.50); hFil = design(hFilDesign);
Create the data symbols that the communications system transmit by calling the step method of the PSK Modulator System object. Type the following at the MATLAB command line:
d = randi([0 hMod.ModulationOrder-1], 100, 1); sym = step(hMod, d);
Create a scatter plot and set the samples per symbol to the upsampling rate of the signal. Type the following at the MATLAB command line:
hScope = commscope.ScatterPlot hScope.SamplesPerSymbol = Rup; xmt = filter(hFil, upsample(sym, Rup));
In this simulation, the absolute sampling rate or symbol rate is not specified. Use the default value for SamplingFrequency, which is 8000. This results in 2000 symbols per second symbol rate.
Set the scatter plot constellation to the theoretical QPSK pi/4 constellation. Type the following at the MATLAB command line:
hScope.Constellation = pi/4 * [1+1j -1+1j -1-1j 1-1j];
Because the pulse shaping filter introduces a delay, discard these transient values by setting MeasurementDelay to the group delay of the filter. In this example, the group delay is four symbol durations or 4/Rs seconds. Type the following at the MATLAB command line:
groupDelay = (hFilDesign.NumberOfSymbols/2); hScope.MeasurementDelay = groupDelay /hScope.SymbolRate;
Update the scatter plot with transmitted signal by typing the following at the MATLAB command line:
update(hScope, xmt)

The Figure window updates, displaying the transmitted signal.
Display the ideal constellation and evaluate how closely it matches the transmitted signal. To display the ideal constellation, type the following at the MATLAB command line:
hScope.PlotSettings.Constellation = 'on';

The Figure window updates, displaying the ideal constellation and the transmitted signal.
One way to create a better match between the two signals is to normalize the filter. Normalize the filter by typing the following at the MATLAB command line:
hFil.Numerator = hFil.Numerator / max(hFil.Numerator);
Refilter the signal using a normalized filter.
xmt = filter(hFil, upsample(sym, Rup));
Reset the scope before displaying the transmitted signal. Resetting the scope also resets the counter for measurement delay, discarding the transient filter values. To reset the scope, type the following at the MATLAB command line:
reset(hScope)
Update the scatter plot so it displays the signal.
update(hScope, xmt)

The match between the ideal constellation points and the transmitted signal is nearly identical.
To view the transmitted signal more clearly, turn off the ideal constellation by clicking Constellation in the Figure window.

The Figure window updates, displaying only the transmitted signal.
View the signal trajectory. Type the following at the MATLAB command line:
hScope.PlotSettings.SignalTrajectory = 'on';

The Figure window updates, displaying the trajectory. An alternate way to display the signal trajectory is to click the Signal Trajectory.
Change the line style. Type the following at the MATLAB command line:
hScope.PlotSettings.SignalTrajectoryStyle = ':m';

The Figure window updates, changing the line style making up the signal trajectory.
Autoscale the scatter plot display to fit the entire plot. Type the following at the MATLAB command line:
autoscale(hScope)

The Figure window updates. An alternate way to autoscale the fit is to click the Autoscale Axes button.
Create a noisy signal by Passing xmt through an AWGN channel. Type the following at the MATLAB command line:
rcv = awgn(xmt, 20, 'measured'); % Add AWGN
Send the received signal to the scatter plot. Before sending the signal, reset the scatter plot to remove the old data. Type the following at the MATLAB command line:
reset(hScope) update(hScope, rcv)

The Figure window updates, displaying the noisy signal.
Turn off the signal trajectory by clicking Signal Trajectory in the Figure window.

The Figure window updates, displaying the signal plot without the signal trajectory. An alternate way to turn off the signal trajectory is typing the following at the MATLAB command line:
hScope.PlotSettings.SignalTrajectory = 'off';
View the constellation by clicking Constellation in the Figure window.

The Figure window updates, displaying both the ideal constellation and the transmitted signal. An alternate way to view the constellation is by typing the following at the MATLAB command line:
hScope.PlotSettings.Constellation = 'on';
Print the scatter plot by making the following selection in the Figure window: File > Print

When you print the scatter plot, you print the axes, not the entire GUI.
To plot the signal constellation associated with a modulation process, follow these steps:
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.
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.
Apply the scatterplot function to the modulated output to create a plot.
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;

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;

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;

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');

This example simulates RF impairments for a signal that was modulated using differential quaternary phase shift keying (DQPSK). Open the example model by typing doc_receiverimpairments_dqpsk at the MATLAB command line.
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.
![]() | Eye Diagram Analysis | Channel Visualization | ![]() |

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 |