| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Communications Blockset |
| Contents | Index |
| Learn more about Communications Blockset |
| On this page… |
|---|
Accessing Digital Modulation Blocks Digital Modulation Features of the Blockset Representing Signals for Digital Modulation Upsampled Signals and Rate Changes Examples of Digital Modulation |
Like analog modulation, digital modulation alters a transmittable signal according to the information in a message signal. However, in this case, the message signal is a discrete-time signal that can assume finitely many values. This section describes how to modulate and demodulate digital signals with Communications Blockset.
For background material on the subject of digital modulation, see the works listed in Selected Bibliography for Digital Modulation.
Open the Modulation library by double-clicking the icon in the main Communications Blockset library. Then open the Digital Baseband sublibrary by double-clicking its icon in the Modulation library.
The Digital Baseband library has sublibraries of its own. Open each of these sublibraries by double-clicking the icon listed in the table below.
| Kind of Modulation | Icon in Digital Baseband Library |
|---|---|
| Amplitude modulation | AM |
| Phase modulation | PM |
| Frequency modulation | FM |
| Continuous phase modulation | CPM |
| Trellis-coded modulation | TCM |
The figure below shows the modulation techniques that Communications Blockset supports for digital data. All the methods at the far right are implemented in library blocks.

Some digital modulation sublibraries contain blocks that implement special cases of a more general technique and are, in fact, special cases of a more general block. These special-case blocks use the same computational code that their general counterparts use, but provide an interface that is either simpler or more suitable for the special case. The following table lists special-case modulators, their general counterparts, and the conditions under which the two are equivalent. The situation is analogous for demodulators.
General and Specific Blocks
| General Modulator | Specific Modulator | Specific Conditions |
|---|---|---|
| General QAM Modulator Baseband | Rectangular QAM Modulator Baseband | Predefined constellation containing 2K points on a rectangular lattice |
| M-PSK Modulator Baseband | BPSK Modulator Baseband | M-ary number parameter is 2. |
| QPSK Modulator Baseband | M-ary number parameter is 4. | |
| M-DPSK Modulator Baseband | DBPSK Modulator Baseband | M-ary number parameter is 2. |
| DQPSK Modulator Baseband | M-ary number parameter is 4. | |
| CPM Modulator Baseband | GMSK Modulator Baseband | M-ary number parameter is 2, Frequency pulse shape parameter is Gaussian. |
| MSK Modulator Baseband | M-ary number parameter is 2, Frequency pulse shape parameter is Rectangular, Pulse length parameter is 1. | |
| CPFSK Modulator Baseband | Frequency pulse shape parameter is Rectangular, Pulse length parameter is 1. | |
| General TCM Encoder | Rectangular QAM TCM Encoder | Predefined signal constellation containing 2K points on a rectangular lattice |
| M-PSK TCM Encoder | Predefined signal constellation containing 2K points on a circle |
Furthermore, the CPFSK Modulator Baseband block is similar to the M-FSK Modulator Baseband block, when the M-FSK block uses continuous phase transitions. However, the M-FSK features of this blockset differ from the CPFSK features in their mask interfaces and in the demodulator implementations.
For a given modulation technique, two ways to simulate modulation techniques are called baseband and passband. This blockset supports baseband simulation for digital modulation. Baseband simulation, also known as the lowpass equivalent method, requires less computation compared to passband simulation. This is because modeling a high-frequency carrier signal is computationally intensive.
For the mathematical expressions that define baseband signals, see the baseband signal section in the Communications Toolbox documentation.
All digital modulation blocks process only discrete-time signals and use the baseband representation. The data types of inputs and outputs are depicted in the following figure.

Note If you want to separate the in-phase and quadrature components of the complex modulated signal, use the Complex to Real-Imag block in the Simulink Math Operations library. |
Some digital modulation blocks can accept either integers or binary representations of such integers. The corresponding demodulation blocks can output either integers or their binary representations. This section describes how modulation blocks process binary inputs; the case for demodulation blocks is the reverse.
If a modulator block's Input type parameter is set to Bit, the block accepts binary representations of integers between 0 and M-1. It modulates each group of K bits, called a binary word. Also, the input vector length must be an integer multiple of K. If the input is frame-based, then it must be a column vector.
In binary input mode, the Constellation ordering (or Symbol set ordering, depending on the type of modulation) parameter indicates how the block maps a group of K input bits to a corresponding integer. If this parameter is set to Binary, the block maps [u(1) u(2) ... u(K)] to the integer

and subsequently behaves as if this integer were the input value. u(1) is the most significant bit.
For example, if M = 8, Constellation ordering (or Symbol set ordering) is set to Binary, and the binary input word is [1 1 0], the block internally converts [1 1 0] to the integer 6. The block produces the same output as in the case when the input is 6 and the Input type parameter is Integer.
If Constellation ordering (or Symbol set ordering) is set to Gray, the block uses a Gray-coded arrangement. The explicit mapping is described in the algorithm section on the reference page for the M-PSK Modulator Baseband block.
Digital modulation and demodulation blocks sometimes incur delays between their inputs and outputs, depending on their configuration and on properties of their signals. The following table lists sources of delay and the situations in which they occur.
Delays Resulting from Digital Modulation or Demodulation
| Modulation or Demodulation Type | Situation in Which Delay Occurs | Amount of Delay |
|---|---|---|
| FM demodulator | Sample-based input | One output period |
| All demodulators in CPM sublibrary | Sample-based input, D = Traceback length parameter | D+1 output periods |
| Frame-based input, D = Traceback length parameter | D output periods | |
| OQPSK demodulator | Frame-based input | One output period |
| Sample-based input, and the model uses a fixed-step solver with Mode parameter set to Auto or MultiTasking. | Two output periods | |
| Sample-based input, and the model uses a variable-step solver or the Mode parameter is not set to Auto or MultiTasking. | One output period | |
| All demodulators in TCM sublibrary | Operation mode set to Continuous, Tr = Traceback depth parameter, and code rate k/n | Tr*k output bits |
As a result of delays, data that enters a modulation or demodulation block at time T appears in the output at time T+delay. In particular, if your simulation computes error statistics or compares transmitted with received data, it must take the delay into account when performing such computations or comparisons.
In addition to the delays mentioned above, the M-DPSK, DQPSK, and DBPSK demodulators produce output whose first sample is unrelated to the input. This is related to the differential modulation technique, not the particular implementation of it.
Demodulation in the model below causes the demodulated signal to lag, compared to the unmodulated signal. When computing error statistics, the model accounts for the delay by setting the Error Rate Calculation block's Receive delay parameter to 0. If the Receive delay parameter had a different value, then the error rate showing at the top of the Display block would be close to 1/2.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
Random Integer Generator, in the Random Data Sources sublibrary of the Comm Sources library
Set M-ary number to 2.
Set Initial seed to any positive integer scalar, preferably the output of the randseed function.
DBPSK Modulator Baseband, in the PM sublibrary of the Digital Baseband sublibrary of Modulation
Set Phase rotation to 0.
AWGN Channel, in the Channels library
Set Es/No to 4.
DBPSK Demodulator Baseband, in the PM sublibrary of the Digital Baseband sublibrary of Modulation
Set Phase rotation to 0.
Error Rate Calculation, in the Comm Sinks library
Set Receive delay to 0.
Set Computation delay to 1.
Set Output data to Port.
Display, in the Simulink Sinks library
Drag the bottom edge of the icon to make the display big enough for three entries.
Connect the blocks as shown above. From the model window's Simulation, select Configuration parameters. In the Configuration Parameters dialog box, set Stop time to 100. Then run the model and observe the error rate at the top of the Display block's icon. Your error rate will vary depending on your Initial seed value in the Random Integer Generator block.
Some digital modulation blocks can output an upsampled version of the modulated signal, while their corresponding digital demodulation blocks can accept an upsampled version of the modulated signal as input. Each block's Samples per symbol parameter, S, is the upsampling factor in both cases. It must be a positive integer. Depending on whether the signal is frame-based or sample-based, the block either changes the signal's vector size or its sample time, as the table below indicates. Only the OQPSK blocks deviate from the information in the table, in that S is replaced by 2S in the scaling factors.
Processing of Upsampled Modulated Data (Except OQPSK Method)
| Computation Type | Input Frame Status | Result |
|---|---|---|
| Modulation | Frame-based | Output vector length is S times the number of integers or binary words in the input vector. Output sample time equals the input sample time. |
| Modulation | Sample-based | Output vector is a scalar. Output sample time is 1/S times the input sample time. |
| Demodulation | Frame-based | Number of integers or binary words in the output vector is 1/S times the number of samples in the input vector. Output sample time equals the input sample time. |
| Demodulation | Sample-based | Output signal contains one integer or one binary word. Output
sample time is S times the input sample time. Furthermore, if S > 1 and the demodulator is from the AM, PM, or FM sublibrary, the demodulated signal is delayed by one output sample period. There is no delay if S = 1 or if the demodulator is from the CPM sublibrary. |
The following schematics illustrate how a modulator (other than OQPSK) upsamples a triplet of frame-based and sample-based integers. In both cases, the Samples per symbol parameter is 2.

The following schematics illustrate how a demodulator (other than OQPSK or one from the CPM sublibrary) processes three doubly sampled symbols using both frame-based and sample-based inputs. In both cases, the Samples per symbol parameter is 2. The sample-based schematic includes an output delay of one sample period.

This section builds a few simple example models to illustrate the modulation methods and how Communications Blockset allows you to implement them. The examples are
The model below plots the output of the DQPSK Modulator Baseband block. The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
Random Integer Generator, in the Random Data Sources sublibrary of the Comm Sources library
Set M-ary number to 4.
Set Initial seed to any positive integer scalar, preferably the output of the randseed function.
Set Sample time to .01.
DQPSK Modulator Baseband, in the PM sublibrary of the Digital Baseband sublibrary of Modulation
Complex to Real-Imag, in the Simulink Math Operations library
XY Graph, in the Simulink Sinks library
Use the blocks' default parameters unless otherwise instructed. Connect the blocks as in the figure above. Running the model produces the following plot. The plot reflects the transitions among the eight DQPSK constellation points.

This plot illustrates π/4-DQPSK modulation, because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi/4. To see how the phase offset influences the signal constellation, change the Phase offset parameter in the DQPSK Modulator Baseband block to pi/8 or another value. Run the model again and observe how the plot changes.
The model below uses the M-QAM Modulator Baseband block to modulate random data. After passing the symbols through a noisy channel, the model produces a scatter diagram of the noisy data. The diagram suggests what the underlying signal constellation looks like and shows that the noise distorts the modulated signal from the constellation.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
Random Integer Generator, in the Random Data Sources sublibrary of the Comm Sources library
Set M-ary number to 16.
Set Initial seed to any positive integer scalar, preferably the output of the randseed function.
Set Sample time to .1.
Rectangular QAM Modulator Baseband, in the AM sublibrary of the Digital Baseband sublibrary of Modulation
Set Normalization method to Peak Power.
AWGN Channel, in the Channels library
Set Es/No to 20.
Set Symbol period to .1.
Discrete-Time Scatter Plot Scope, in the Comm Sinks library
Set Points displayed to 160.
Set New points per display to 80.
On the Figure Properties panel, set Scope position to figposition([2.5 55 35 35]);.
On the same panel, set Figure name to QAM Scatter Plot.
Connect the blocks as in the figure. From the model window's Simulation menu, select Configuration parameters. In the Configuration Parameters dialog box, set Stop time to 250. Running the model produces a scatter diagram like the following one. Your plot might look somewhat different, depending on your Initial seed value in the Random Integer Generator block. Because the modulation technique is 16-QAM, the plot shows 16 clusters of points. If there were no noise, the plot would show the 16 exact constellation points instead of clusters around the constellation points.

This example plots a phase tree associated with a continuous phase modulation scheme. A phase tree is a diagram that superimposes many curves, each of which plots the phase of a modulated signal over time. The distinct curves result from different inputs to the modulator.
This example uses the CPM Modulator Baseband block for its numerical computations. The block is configured so that it uses a raised cosine filter pulse shape. The example also illustrates how you can use Simulink and MATLAB together. The example uses MATLAB commands to run a series of simulations with different input signals, to collect the simulation results, and to plot the full data set.
Note In contrast to this example's approach using both MATLAB and Simulink, the commcpmphasetree demo produces a phase tree using a Simulink model without additional lines of MATLAB code. |

The first step of this example is to build the model. To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:
DSP Constant (Obsolete), in the Signal Processing Sources library
Set Constant value to s (which will appear in the MATLAB workspace).
Set Output to Frame-based.
Set Frame period to 1.
Set M-ary number to 2.
Set Modulation index to 2/3.
Set Frequency pulse shape to Raised Cosine.
Set Pulse length to 2.
To Workspace, in the Simulink Sinks library
Set Variable name to x.
Set Save format to Array.
Do not run the model, because the variable s is not yet defined in the MATLAB workspace. Instead, save the model to a folder on your MATLAB path, using the filename doc_phasetree.
The second step of this example is to execute these commands in MATLAB:
% Parameters from the CPM Modulator Baseband block
M_ary_number = 2;
modulation_index = 2/3;
pulse_length = 2;
samples_per_symbol = 8;
opts = simset('SrcWorkspace','Current',...
'DstWorkspace','Current');
L = 5; % Symbols to display
pmat = [];
for ip_sig = 0:(M_ary_number^L)-1
s = de2bi(ip_sig,L,M_ary_number,'left-msb');
% Apply the mapping of the input symbol to the CPM
% symbol 0 -> -(M-1), 1 -> -(M-2), etc.
s = 2*s'+1-M_ary_number;
sim('doc_phasetree', .9, opts); % Run model to generate x.
% Next column of pmat
pmat(:,ip_sig+1) = unwrap(angle(x(:)));
end;
pmat = pmat/(pi*modulation_index);
t = (0:L*samples_per_symbol-1)'/samples_per_symbol;
plot(t,pmat); figure(gcf); % Plot phase tree.
The resulting plot follows. Each curve represents a different instance of simulating the CPM Modulator Baseband block with a distinct (constant) input signal.

Some digital demodulation blocks can compute bitwise log-likelihood ratio (LLR) and approximate LLR values that can be used by some decoders (such as the Viterbi Decoder block) to achieve better BER performance. To compute LLR or approximate LLR, these blocks need, along with other parameters, the variance of the noise in the input signal.
If you are adding noise to the transmitted signal using the AWGN Channel block, there are various methods for computing the noise variance at the input of a demodulator block based on the Mode parameter of the AWGN Channel block, as shown in the following figure.

The example model doc_noisevariance_ebno shows the case where the AWGN Channel block's Mode parameter is set to Signal to noise ratio (Eb/No).
To open the model, navigate to the <MATLAB>/help/toolbox/commblks/examples folder and type doc_noisevariance_ebno at the MATLAB command line, or click here, if you are viewing this in the MATLAB help browser.
The BPSK Demodulator Baseband block's Decision type is set to Log-likelihood ratio, and the Noise variance source is set to Dialog. The Dialog setting enables a field, Noise variance, which is then set to Pi/(10^(EbNo/10)), where Pi is the input signal power, in watts, and EbNo is the ratio of bit energy to noise power spectral density, in decibels.
The AWGN Channel block requires both Eb/No and Input signal power parameters to define the noise that it adds to the signal. Variables such as Pi and EbNo are defined by the example model in the base workspace.
The example doc_noisevariance_esno (also found in <MATLAB>/help/toolbox/commblks/examples) shows how to calculate noise variance for the MPSK Demodulator Baseband block, computing approximate LLR when the AWGN Channel block's Mode parameter is set to Signal to noise ratio (Es/No).
The method of computing noise variance remains the same, whether the computation is using LLR or approximate LLR. The noise variance is given as Pi/(10^(EsNo/10)), where Pi is the input signal power, in watts, and EsNo is the ratio of signal energy to noise power spectral density, in decibels.
The AWGN Channel block uses the two parameters, Es/No and Input signal power, along with others, to compute the noise it adds to the signal.
doc_noisevariance_snr (found in the same folder) demonstrates the use of the Signal to noise ratio (SNR) mode of the AWGN Channel block.
In this example, the Rectangular QAM Demodulator Baseband block, which computes the LLR, is given the noise variance of its input signal as Pi/(10^(SNR/10)), where Pi is the input signal power, in watts, and SNR is the ratio of signal power to noise power, in decibels.
The noise variance is computed using the parameters needed by the AWGN Channel block to define the noise added to the signal.
Some linear modulator blocks now provide the capability to visualize a signal constellation 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.
One plot provides a reference constellation using double precision data type
The other plot provides data whose data type selection is defined in the block mask
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 Backpropagation for the Output Data Type generates a constellation plot with double as the Output data type.
In this tutorial, you will make changes to the modulator block. Without actually applying the changes to the model itself, you will observe how these changes affect the signal constellation.
Open the constellation visualization tutorial model by typing doc_CVTutorialModel at the MATLAB command line.
Double-click on the Rectangular QAM Modulator Baseband block.
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 datatype. Because the Input type is integer, the constellation has integer symbol mapping.
From the block mask, select bit for the Input type parameter.
Select gray for the Constellation ordering parameter.
Click View Constellation, and observe the results. Even though you did not click Apply, making these changes part of the model, but that the constellation plot still updates. The plot indicates gray constellation ordering and a bit representation of symbols.

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 Output data type to Fixed-point.
Set Output word length to 16.
Set Output fraction length to Best precision.
Click Main tab, and then click View Constellation.

The plot overlays the fixed-point constellation on top of the double-precision constellation.
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.
In the block mask, click the Main tab, then type M for the M-ary number parameter. This parameter allows the block to use the variable value you defined in MATLAB workspace.
Click the Data Types tab and then select double for the Output data type parameter.
Click the Main tab. Then, click theView Constellation button and observe the results.

You can use the Constellation Visualization feature when a simulation is running. Type M=16 in the MATLAB workspace, select integer for the Input type and click Apply.
Simulate the model by clicking Start in the Simulink model window.

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

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.
Close the Simulink model, and observe that all of the constellation figures also close.
[1] Anderson, J. B., T. Aulin, and C.-E. Sundberg, Digital Phase Modulation, New York, Plenum Press, 1986.
[2] Biglieri, E., D. Divsalar, P.J. McLane, and M.K. Simon, Introduction to Trellis-Coded Modulation with Applications, New York, Macmillan, 1991.
[3] Jeruchim, M. C., P. Balaban, and K. S. Shanmugan, Simulation of Communication Systems, New York, Plenum Press, 1992.
[4] Pawula, R.F., "On M-ary DPSK Transmission Over Terrestrial and Satellite Channels," IEEE Transactions on Communications, Vol. COM-32, July 1984, pp. 752–761.
[5] Smith, J. G., "Odd-Bit Quadrature Amplitude-Shift Keying," IEEE Transactions on Communications, Vol. COM-23, March 1975, pp. 385–389.
![]() | Analog Modulation | Communications Filters | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |