This section describes an example model of a communications system. The model displays a scatter plot of a signal with added noise. The purpose of this section is to familiarize you with the basics of Simulink^{®} models and how they function.
To open the model, first start MATLAB^{®}. In the MATLAB Command
Window, enter doc_commphasenoise
at
the prompt. This opens the model in a new window, as shown in the
following figure.
The model shown in the preceding section, Opening the Model, simulates the effect of phase noise on quadrature amplitude modulation (QAM) of a signal. The Simulink model is a graphical representation of a mathematical model of a communication system that generates a random signal, modulates it using QAM, and adds noise to simulate a channel. The model also contains components for displaying the symbol error rate and a scatter plot of the modulated signal.
The blocks and lines in the Simulink model describe mathematical relationships among signals and states:
The Random Integer Generator block, labeled Random Integer, generates a signal consisting of a sequence of random integers between zero and 255
The Rectangular QAM Modulator Baseband block, to the right of the Random Integer Generator block, modulates the signal using baseband 256-ary QAM.
The AWGN Channel block models a noisy channel by adding white Gaussian noise to the modulated signal.
The Phase Noise block introduces noise in the angle of its complex input signal.
The Rectangular QAM Demodulator Baseband block, to the right of the Phase Noise block, demodulates the signal.
In addition, the following blocks in the model help you interpret the simulation:
The Constellation Diagram block, labeled AWGN plus Phase Noise, displays a scatter plot of the signal with added noise.
The Error Rate Calculation block counts symbols that differ between the received signal and the transmitted signal.
The Display block, at the far right of the model window, displays the symbol error rate (SER), the total number of errors, and the total number of symbols processed during the simulation.
All these blocks are included in Communications System Toolbox™. You can find more detailed information about these blocks by right-clicking the block and selecting Help from the context menu.
This model simulates quadrature amplitude modulation (QAM), which is a method for converting a digital signal to a complex signal. The model modulates the signal onto a sequence of complex numbers that lie on a lattice of points in the complex plane, called the constellation of the signal. The constellation for baseband 256-ary QAM is shown in the following figure.
Constellation for 256-ary QAM
To run a simulation, click on the Run button at the top of the model window. The simulation stops automatically at the Stop time, which is specified in the Configuration Parameters dialog box. You can stop the simulation at any time by selecting Stop from the Simulation menu at the top of the model window (or, on Microsoft Windows, by clicking the Stop button on the toolstrip).
When you run the model, a new window appears, displaying a scatter plot of the modulated signal with added noise, as shown in the following figure.
Scatter Plot of Signal Plus Noise
The points in the scatter plot do not lie exactly on the constellation shown in the figure because of the added noise. The radial pattern of points is due to the addition of phase noise, which alters the angle of the complex modulated signal.
The Display block displays the number of errors introduced by the channel noise. When you run the simulation, three small boxes appear in the block, as shown in the following figure, displaying the vector output from the Error Rate Calculation block.
Note: The image below is a representative example and may not exactly match results you see when running in Simulink. |
Error Rate Display
The block displays the output as follows:
The first entry is the symbol error rate (SER).
The second entry is the total number of errors.
The third entry is the total number of comparisons
made. The notation 1e+004
is shorthand for 10^{4}.
You can control the way a Simulink block functions by setting its parameters. To view or change a block's parameters, double-click the block. This opens a dialog box, sometimes called the block's mask. For example, the dialog box for the Phase Noise block is shown in the following figure.
Dialog for the Phase Noise Block
To change the amount of phase noise, click in the Phase noise level (dBc/Hz) field and enter a new value. Then click OK.
Alternatively, you can enter a variable name, such as phasenoise
,
in the field. You can then set a value for that variable in the MATLAB
Command Window, for example by entering phasenoise = -60
.
Setting parameters in the Command Window is convenient if you need
to run multiple simulations with different parameter values.
You can also change the amount of noise in the AWGN Channel block. Double-click the block to open its dialog box, and change the value in the Es/No parameter field. This changes the signal to noise ratio, in dB. Decreasing the value of Es/No increases the noise level.
You can experiment with the model by changing these or other parameters and then running a simulation. For example,
Change Phase noise level (dBc/Hz) to -150
in
the dialog box for the Phase Noise block.
Change Es/No to 100
in
the dialog for the AWGN Channel block.
This removes nearly all noise from the model. When you now run a simulation, the scatter plot appears as in the figure Constellation for 256-ary QAM.
Double-click the block labeled "Display Figure" at the bottom left of the model window. This displays a plot showing the results of multiple simulations.
BER Plot at Different Noise Levels
Each curve is a plot of bit error rate as a function of signal to noise ratio for a fixed amount of phase noise.
You can create plots like this by running multiple simulations with different values for the Phase noise level (dBc/Hz) and Es/No parameters.