Digital Communication Simulation Using Matlab Computer Science Essay
Objective – Aim – Scope of the assignment
“The objective of this assessment is to model and analyse modulation and coding in Communication Systems using Matlab.”[1] This lab exercise aims to teach (show) modulation & demodulation techniques like QAM 64 over AWGN wireless channel throw Matlab’s Communication toolbox.
In task 1, simulation and analysis of modulation and demodulation (using the 64-QAM) is been perform. By use of Matlab’s high performance language, a designed code is been given in each task. Transmitted and received signals are been show in scatter plots at different SNR values.
Simulation of the rectangular pulse shaping filter in combination with modulation is been introduced in the second part. The effect of rectangular pulse shaping is been used at the transmitter side after the QAM-64 modulation. Integrate and dump operation effect is been used at the receiver side. A full analysis of these two effects is been given below. In both tasks, the transmission is being over an AWGN (Additive White Gaussian Noise) wireless communication channel.
Comparison, analysis and a discussion of the results is been given below each task.
Introduction on general modulation/demodulation and 64-QAM – AWGN channel, noise and rectangular pulse shaping
Modulation – Demodulation – Modem
In the area of telecommunications, modulation is the process of changing a periodic waveform (i.e. a tone), in order to use that signal to transfer a message. Normally the carrier signal (usually is a sinusoidal) has higher frequency than the input signal. Amplitude, phase and frequency are the three key parameters of a sine wave. These parameters can be modified in accordance with a low frequency information signal to obtain the modulated signal. Amplitude modulation (AM), frequency modulation (FM) and phase modulation are the most common analog modulation techniques. Radio and television broadcast stations typically use AM or FM. More complex forms of modulation are Phase Shift Keying (PSK), Amplitude Shift Keying (ASK) and Frequency Shift Keying (FSK) which are the three basic digital modulation techniques.
A device that performs modulation is known as a modulator and a device that performs the inverse operation of modulation is known as a demodulator. “A modulator converts a digital signal to an analog signal (typically a sinusoidal signal) and a demodulator converts a modulated (analog) signal back to the original unmodulated (digital) signal.”[2] A few years ago a computer was connected to the internet through a modem (in now days a different type is being used, ADSL modem/router) over a regular analog line. “A modem converts an outgoing digital signal to an outgoing modulated signal, and converts an incoming modulated signal to an incoming digital signal.”[2]
Modulation is used “to change the signal’s bandwidth so it can be transmitted on a limited-bandwidth communication channel (like a telephone line or a cable TV channel) without too much distortion.”[2] It also allows more connected users on the same communication link.
Digital modulation
Digital modulation schemes transform digital signals into waveforms that are compatible with the nature of the communications channel. There are two major categories of digital modulation. One category uses a constant amplitude carrier and the other carries the information in phase or frequency variations (FSK, PSK). The other category conveys the information in carrier amplitude variations and is known as amplitude shift keying (ASK).
“In digital communications, modulation is often expressed in terms of I and Q. This is a rectangular representation of the polar diagram. On a polar diagram, the I axis lies on the zero degree phase reference, and the Q axis is rotated by 90 degrees. The signal vector’s projection onto the I axis is its “I” component and the projection onto the Q axis is its “Q” component.”[5]
Figure 1 – “I-Q” format [5]
Figure 2 – Trends in the industry [5]
Main Digital Modulation Schemes – Techniques
Amplitude Shift Keying (ASK)
Amplitude shift keying represents digital data as variations in the amplitude of a carrier wave. There is an on/off transmission that represents the binary logic 1/0. ASK has poor performance cause is heavily affected by noise and interference. For binary digital modulation, BASK is the simpler form of ASK.
Figure 3 – Amplitude Shift Keying (ASK) [3]
Frequency Shift Keying (FSK)
The carrier’s frequency is modulated by the digital signal. “1/0 represented by two different frequencies slightly offset from carrier frequency.”[4] “That means that is a different frequency for “1” and another frequency for “0”. FSK can be expanded to a M-ary scheme, employing multiple frequencies as different states.”[3] For binary digital modulation BFSK is the simpler form of FSK.
Figure 4 – Frequency Shift Keying (FSK) [3]
Phase Shift Keying (PSK)
Phase-shift keying (PSK) is a digital modulation scheme that conveys data by changing, or modulating, the phase of the carrier wave. Phases are separated by 180o. Phase modulation “can be achieved simply by defining a relative phase shift from the carrier, usually equi-distant for each required state. Therefore a two level phase modulated system, such as Binary Phase Shift Keying, has two relative phase shifts from the carrier, + or – 90o. Phase modulation requires coherent generation and as such if an IQ modulation technique is employed this filtering can be performed at baseband.” [6]
Figure 5 – Phases separated by 180o on BPSK [4]
Figure 6 – Phase Shift Keying (PSK) [3]
Multi-Symbol Signalling – M-ary Signals
“Multiple-symbol signaling is the process where multiple levels are used to encode binary information into groups of two bite, four bits, etc.” [8]
Figure 7 – M-ary signals [3]
“Amplitude and phase shift keying can be combined to transmit several bits
per symbol (in the above figure M=4). These modulation schemes are often refered to as linear, as they require linear amplification. 16-QAM has the largest distance between points, but requires very linear amplification. 16PSK has less stringent linearity requirements, but has less spacing between constellation points, and is therefore more affected by noise. M-ary schemes are more bandwidth efficient, but more susceptible to noise.” [3]
Quadrature Phase Shift Key Modulation (QPSK)
Quadrauture Phase Shift Keying is a form of PSK. QPSK is a system of modulating digital signals onto a radio-frequency carrier signal using four phase states to code two digital bits.
“QPSK is effectively two independent BPSK systems (I and Q), and therefore exhibits the same performance but twice the bandwidth efficiency. QPSK can be filtered using raised cosine filters to achieve excellent out of band suppression. Large envelope variations occur during phase transitions, thus requiring linear amplification.” [3]
Figure 8 – QPSK [4]
Quadrature amplitude modulation (QAM)
Quadrature amplitude modulation is a combination of amplitude modulation and phase shift keying. It is a modulation scheme-technique which conveys data by modulating the amplitude of two carrier waves. That is an amplitude modulation on both quadrature carriers. These two waves, usually sinusoids, are out of phase with each other by 90° and are that is why they called quadrature carriers. QAM has extensive use in digital microwave radio links. The 16-QAM below stands for 2n discrete levelsƒ n=2 same as in the above QPSK.
Figure 9 – 16-QAM
Figure 10 – 16-QAM [7]
Additive White Gaussian Noise (AWGN)
Additive means that the sum of the transmitted signal and noise produce the received signal. White means that “its two sided power spectral density is flat for all frequencies of interest for radio communication system. The amplitude of the noise is distributed according to a normal or Gaussian distribution.” [8] Its information gives a single impairment.
Noise pulse shaping and rectangular pulse shaping
In digital telecommunications, pulse shaping can be used to change the waveform of transmitted pulses, so the signal bandwidth matches that of the communication channel, reducing distortion and intersymbol interference. In other words its purpose is to make the transmitted signal suit better to the communication channel by limiting the effective bandwidth of the transmission. Modulation is often followed by pulse shaping.
“Rectangular pulse shaping repeats each output from the modulator a fixed number of times to create an up-sampled signal. Rectangular pulse shaping can be a first step or an exploratory step in algorithm development, though it is less realistic than other kinds of pulse shaping. If the transmitter up-samples the modulated signal, then the receiver should down-sample the received signal before demodulating. The “integrate and dump” operation is one way to down-sample the received signal.” [8] Demodulation is often preceded by a filtering or an intergrate and dump-operation.
Answers to assignments tasks
Task 1
In this assignment you are required to design and implement the process of modulating a random binary data stream using 64-level QAM (quadrature amplitude modulation), transmitting it over an AWGN (Additive White Gaussian Noise) wireless communication channel, and demodulating the received signal using the 64- QAM demodulator. Your system should consist of a baseband modulator, AWGN channel, and a demodulator. The following table indicates some relevant functions from the Matlab Communications Toolbox which may be used in this assignment. The functions for 64-QAM modulator/demodulator can be taken from the Matlab Communications Toolbox, or even implemented by you.
Job
Function
Generate a random binary data stream
randint
Add white Gaussian noise
awgn
Create a scatter plot
scatterplot
Compute the system’s BER
biterr
The length of the binary data stream (i.e., the number of the rows in the column vector) is set to 5000.
Task 1.1
Write codes to 1) Display the transmitted and received signals in different scatter plots for the following two situations: a) SNR = 40 dB; b) SNR = 14dB; 2) Compute the system’s bit error rate (BER) for the two situations.
Answer 1.1
1a) The m-file for SNR=40dB
x=randint(4998,1); %Random binary data stream of 4998 digits
%Bits to symbols mapping
xsymbols=bi2de(reshape(x,6,length(x)/6).’,’left-msb’);
y=qammod(xsymbols,64); %Modulation using the 64-QAM
yTx=y; %Transmitted signal
scatterplot(yTx)
grid;
title(‘Transmitted Signal’)
%Transmission over an Additive White Gaussian Noise channel,SNR=40dB
ynoise=awgn(yTx,40,’measured’);
yRx=ynoise; %Received signal
scatterplot(yRx)
grid;
title(‘Received Signal, SNR=40dB’)
zsymbols=qamdemod(yRx,64); %Demodulation using the 64-QAM
z=de2bi(zsymbols,’left-msb’); %Symbols to bits mapping
z=reshape(z.’,prod(size(z)),1);
%Computation of Number of Erros and Bit Error Rate
[Number_of_errors,Bit_Error_Rate]=biterr(x,z)
Figure 11 – Transmitted signal
Figure 12 – Received signal
1b) The m-file for SNR=14dB
x=randint(4998,1); %Random binary data stream of 4998 digits
%Bits to symbols mapping
xsymbols=bi2de(reshape(x,6,length(x)/6).’,’left-msb’);
y=qammod(xsymbols,64); %Modulation using the 64-QAM
yTx=y; %Transmitted signal
scatterplot(yTx)
grid;
title(‘Transmitted Signal’)
%Transmission over an Additive White Gaussian Noise channel,SNR=40dB
ynoise=awgn(yTx,14,’measured’);
yRx=ynoise; %Received signal
scatterplot(yRx)
grid;
title(‘Received Signal, SNR=14dB’)
zsymbols=qamdemod(yRx,64); %Demodulation using the 64-QAM
z=de2bi(zsymbols,’left-msb’); %Symbols to bits mapping
z=reshape(z.’,prod(size(z)),1);
%Computation of Number of Erros and Bit Error Rate
[Number_of_errors,Bit_Error_Rate]=biterr(x,z)
Figure 13 – Transmitted signal
Figure 14 – Received signal
2) Computation of the system’s bit error rate for the two situations
SNR=40dB
SNR=14dB
Task 1.2
Compare/explain in detail the results obtained in a) and b), and explain clearly how the differences come from.
Answer 1.2
In the above code, there is a bit to symbol mapping. A bit can’t take values from 0-63 but a group of bits can.
The two transmitted signals are identical cause both signals modulated with the same modulation schemes (64-QAM) and transmitted throw the same channel (Additive White Gaussian Noise wireless channel).
Received signals have different scatter plot. This happens cause the first received signal was transmitted throw a channel with SNR=40dB and the other one was transmitted throw a channel with SNR=14dB. In the second scatter plot it is obvious that the channel is too noisy in accordance with the first scatter plot which seems that it hasn’t got any clue of noise. For example, if a ADSL line has SNR lower than 15dB then several problems occurred like frequent disconnections etc.
According to scatter plots the bit error rate and the number of errors for the first signal with SNR=40 was expected to be 0 cause the channel was clear from noise. On the contrary, for the second signal with SNR=14dB bit error rate and number of errors expected to be non zero. Both expectations verified.
The ratio of the signal strength to the noise level is called the signal to- noise ratio (SNR), . “If the SNR is high (ie. the signal power is much greater than the noise power) few errors will occur. However, as the SNR reduces, the noise may cause symbols to be demodulated incorrectly, and errors will occur.” [3]
Task 2
Modulation is often followed by pulse shaping, and demodulation is often preceded by a filtering or an integrate-and-dump operation. In this task you are required to investigate the effect of rectangular pulse shaping by using it at the transmitter side after the 64-QAM modulation and also the effect of integrate-and-dump operation at the receiver side. Rectangular pulse shaping repeats each output from the modulator a fixed number of times to create an upsampled signal. If the transmitter upsamples the modulated signal, then the receiver should downsample the received signal before demodulation. The “integrate-and-dump” operation is one way to downsample the received signal. The following table indicates the additional relevant functions from the Matlab Communications Toolbox which may be used in this assignment.
Job
Function
Rectangular pulse shaping
rectpulse
Intergrate-and-dump downsampling
Intdump
Task 2.1
Write codes to 1) Display the received signals in scatter plots when a) SNR = 40 dB; b) SNR = 14dB; 2) Compute the system’s bit error rate (BER) for the two situations.
Answer 2.1
1a) The m-file for SNR=40dB
%Random binary data stream of 5004 digits
x = randint(5004,1);
%Bit to Symbol Mapping
xsymbols = bi2de(reshape(x,6,length(x)/6).’,’left-msb’);
%Modulation using the 64-QAM.
y = qammod(xsymbols,64);
%Pulse shaping, 3 samples per symbol
shaped=rectpulse(y,6);
%Transmitted Signal
yTx = shaped;
scatterplot(yTx)
title(‘Transmitted signal’)
grid;
%Transmission over an Additive White Gaussian Noise channel,SNR=14dB
ynoise = awgn(yTx,40,’measured’);
%Received Signal
yRx = ynoise ;
%Integrate and dump
deshaped=intdump(yRx,6);
scatterplot(deshaped)
title(‘Received signal,SRN=40dB’)
grid;
%Demodulation using the 64-QAM
zsymbols = qamdemod(deshaped,64);
%Symbol to bit mapping –> to perform the computation of BER
z = de2bi(zsymbols,’left-msb’);
a = reshape(z.’,prod(size(z)),1);
%Computation of Number of Erros and Bit Error Rate
[Number_of_errors,Bit_Error_Rate] = biterr(x,a)
Figure 15 – Received signal,SNR=40dB
1b) The m-file for SNR=14dB
%Random binary data stream of 5004 digits
x = randint(5004,1);
%Bit to Symbol Mapping
xsymbols = bi2de(reshape(x,6,length(x)/6).’,’left-msb’);
%Modulation using the 64-QAM.
y = qammod(xsymbols,64);
%Pulse shaping, 3 samples per symbol
shaped=rectpulse(y,6);
%Transmitted Signal
yTx = shaped;
scatterplot(yTx)
title(‘Transmitted signal’)
grid;
%Transmission over an Additive White Gaussian Noise channel,SNR=14dB
ynoise = awgn(yTx,14,’measured’);
%Received Signal
yRx = ynoise ;
%Integrate and dump
deshaped=intdump(yRx,6);
scatterplot(deshaped)
title(‘Received signal,SRN=14dB’)
grid;
%Demodulation using the 64-QAM
zsymbols = qamdemod(deshaped,64);
%Symbol to bit mapping –> to perform the computation of BER
z = de2bi(zsymbols,’left-msb’);
a = reshape(z.’,prod(size(z)),1);
%Computation of Number of Erros and Bit Error Rate
[Number_of_errors,Bit_Error_Rate] = biterr(x,a)
Figure 16 – Received signal,SNR=14dB
2) Computation of the system’s bit error rate for the two situations
SNR=40dB
SNR=14dB
Task 2.2
Compare/explain the results with those obtained in Task 1, and explain clearly how the differences come from.
Answer 2.2
The difference between Task1 and Task 2 are the rectangular pulse shaping and integrate and dump operation. Rectangular pulse shape upsampling the signal after modulation. It actually applies a square pulse to the signal and repeats each symbol several times (in this case symbols are repeated 6 times). The dump operation is downsampling the signal. It is actually an integral of the signal for a single period.
In this case, modulation followed by pulse shaping and demodulation preceded by integrate and dump operation. Since rectangular pulse shaping repeats each output from the modulator a fixed number of times then we expected our signals to be better than those in task1. This expectation came true since BER for SNR=40 dB is 0 and for SNR=14 dB is 0.0038. In the second case when SNR=14 dB it is obvious that BER and number of errors reduced dramatically.
The filtering on the transmitter causes intersymbol interference. “The filtering at the transmitter and the channel typically cause the received pulse sequence to suffer from interysmbol interference and this appear as an amorphous “smeared” signal, not quite ready for sampling and detection.” “When the channel bandwidth is much greater than the pulse bandwidth, the spreading of the pulse will be slight. When the channel bandwidth is close to the signal bandwidth, the spreading will exceed symbol duration and cause signal pulses to overlap. This overlapping is called intersymbol interference.” [11] Rectangular pulse shaping was used to minimize distortion and the effect of intersymbol interference. It made the transmitted signal fit better to the communication channel by limiting the effective bandwidth of the transmission.
The BER and number of errors improvement succeeded because symbols were sent several times. In this case, filtering made the signal better. “Without filtering, signals would have very fast transitions between states and therefore very wide frequency spectra – much wider than is needed for the purpose of sending information.” [5]
Conclusions
If the SRN value is high enough, the received signal is almost clear from noise.
High SNR value stands for a value close to zero for Bit Error Rate.
In the presence of noise and interference, it is necessary to increase signal power to reduce the possibility of errors.
The bit error rate (BER) of a system indicates the quality of the link.
Filtering is essential for good bandwidth efficiency.
“High level M-array schemes (such as 64-QAM) are very bandwidth-efficient but more susceptible to noise and require linear amplification.” [3]
Order Now