Uploaded by mohammed khaled

Lab 2

advertisement
ETN3046 Analog & Digital Communications
FACULTY OF ENGINEERING
LAB SHEET
ETN3046
ANALOG AND DIGITAL COMMUNICATIONS
TRIMESTER 1 (2020/2021)
ADC2 – Digital Carrier Modulation
Page 1
ETN3046 Analog & Digital Communications
ADC2 – Digital Carrier Modulation with MATLAB
A) OBJECTIVES


To understand digital carrier modulation such as ASK, FSK and PSK and QAM.
To use GNU Octave to:
- Create ASK, PSK, FSK and 16 QAM signals by modulating a binary bit stream on a carrier.
- Examine the modulated signals in the time domain.
B) SOFTWARE REQUIRED

GNU Octave version 5.2.0
C) THEORY OF DIGITAL CARRIER MODULATION
Baseband digital signals are suitable for transmission over a pair of wires or coaxial cables due to its
sizable power at low frequencies. These signals cannot be transmitted over a radio link because this would
require impractically large antennas to efficiently radiate the low-frequency spectrum of the signal. Hence,
for such purposes, we use analog modulation techniques in which the digital signal messages are used to
modulate a high-frequency continuous-wave (CW) carrier.
In binary modulation schemes, the modulation process corresponds to switching (or keying) the
amplitude, frequency or phase of the CW carrier between either of two values corresponding to binary
symbols “0” or “1”. The three types of digital modulation are amplitude-shift keying (ASK), frequencyshift keying (FSK) and phase-shift keying (PSK).
Amplitude-Shift Keying (ASK)
In ASK, the amplitude of the carrier assumes one of the two amplitudes dependent on the logic states of
the input bit stream. This modulated signal can be expressed as:
0
x c (t )  
 A cos  c t
symbol "0"
(1)
symbol "1"
Note that the modulated signal is still an on-off signal.
Frequency-Shift Keying (FSK)
In FSK, the frequency of the carrier is changed to two different frequencies depending on the logic state
of the input bit stream. Usually, a logic high causes the centre frequency to increase to a maximum and a
logic low causes the centre frequency to decrease to minimum. The modulated signal can be expressed as:
 A cos 1t
x c (t )  
 A cos  2 t
symbol "0"
(2)
symbol "1"
Phase-Shift Keying (PSK)
In PSK, the phase of the carrier changes between different phases determined by the logic states of the
input bit stream. In two-phase shift keying, the carrier assumes one of the two phases. A logic “1” produces
no phase change and a logic “0” produces a 1800 phase changes This modulated signal can be expressed as:
Page 2
ETN3046 Analog & Digital Communications
 A cos( c t   )
x c (t )  
 A cos  c t
symbol "0"
(3)
symbol "1"
Figure 1 illustrates the above digital modulation schemes for the case in which the data bits are
represented by the polar NRZ waveform.
Figure 1− Digital Carrier Modulation
Quaternary Phase-Shift Keying (QPSK)
In 4PSK or QPSK, 2 bits are processed to produce a single-phase change. In this case, each symbol
consists of 2 bits. The actual phases that are produced by a QPSK modulated signal are shown in Table 1:
Bits
Phase
00
450
01
1350
10
3150
11
2250
Table 1 − Bits and Phases for 4PSK or QPSK modulation
From Table 1, a signal space diagram or signal constellation can be drawn as shown in Figure 2. Note that
from any two closest bits sequences, there is only one bit change. This is called Gray Coded scheme. For
example, bit sequence “00” has one bit change for its closest bit sequences “01” and “10”.
Page 3
ETN3046 Analog & Digital Communications
/2
01
00

0
11
10
3/2
Figure 2 − 4PSK or QPSK Constellation
Eight Phase-Shift Keying (8PSK)
In this modulation, 3 bits are processed to produce a single-phase change. This means that each symbol
consists of 3 bits. Figure 3 shows the constellation and mapping of the 3-bit sequences onto appropriate
phase angles.
/2
010
000
011
001

0
111
101
110
100
3/2
Figure 3 − 8PSK Constellation
Higher Order Phase Shift Keying
Modulation schemes like 16 PSK, 32 PSK and higher orders can be also be designed and represented on
a signal space diagram.
Page 4
ETN3046 Analog & Digital Communications
Quadrature Amplitude Modulation (QAM)
QAM is a method for sending two separate (and uniquely different) channels of information. The carrier
is shifted to create two carriers namely the sine and cosine versions. The outputs of both modulators are
algebraically summed, the results of which is a single signal to be transmitted, containing the In-phase (I)
and Quadrature-phase (Q) information. The set of possible combinations of amplitudes (A) and phases (),
as shown on an x-y plot, is a pattern of dots known as a QAM constellation as shown in Figure 4.
Quadrature-phase
I value
A
Q value

In-phase
Figure 4 – I-Q Constellation (Diagram)
Consider the 16 QAM modulation schemes, in which 4 bits are processed to produce a single vector. The
resultant constellation consists of four different amplitude distributed in 12 different phases as shown in
Figure 5.
CD
Quadrant 2
0011
0111
3V
Quadrant 1
1011
1111
2V
0010
0110
1010
1110
1V
AB
−3V
−2V −1V
0001
0101
AB
1V
2V
3V
1101
1001
−2V
0000
1100
0100 −3V
Quadrant 3
1000
CD
Quadrant 4
Figure 5 − 16 QAM Constellation
Page 5
ETN3046 Analog & Digital Communications
D) Introduction to GNU Octave
GNU Octave is a multi-functional tool for sophisticated numerical analysis. GNU Octaves provides you
with:
1) A large set of build-in functionalities to solve many different problems.
2) A complete programming language that enables you to extend GNU Octave.
3) Plotting facilities.
GNU Octave uses an interpreter to compile and execute a sequence of instructions given by the user at
run-time. It can be used to solve many different scientific problems, such as data analysis, image processing,
econometrics, advanced statistical analysis, and much more.
To start GNU Octave from Windows, double-click the GNU Octave icon on your Windows desktop.
When GNU Octave starts, the MATLAB desktop opens as shown in Figure 1.1. The window in the desktop
that concerns us for this chapter is the Command Window, where the special prompt appears. This prompt
>> means that GNU Octave is waiting for a command.
GNU Octave has a very useful ‘help’ system. Its help command can provide information about most
operators. For example, type ‘help plot’ to learn how to use GNU Octave’s linear plot function.
Often you will need to execute a sequence of commands. Instead of typing these commands directly into
Octave’s command prompt, you can write them in a text file and then execute that file from the prompt. This
enables you to make any necessary changes later and then execute the file again without having to go
through the tedious labour of rewriting every single command. A file composed of a single command or a
sequence of commands is referred to as a script file. Suppose you want to draw the graph of e −0.2xsin (x) over
the domain 0 to 6π, as shown in Figure 6. The Windows environment lends itself to nifty cut and paste
editing, which you would do well to master. Proceed as follows.
From the GNU Octave desktop, select File -> New -> New Script, or click the new file button on the
desktop toolbar (you could also type edit in the Command Window followed by Enter). This action opens an
unnamed window in the Editor. You can regard this for the time being as a ‘scratch pad’ in which to write
programs. Now type the following two lines in the Editor, exactly as they appear here:
x = 0 : pi/20 : 6*pi;
plot(x, exp(-0.2*x).*sin(x), 'r'), grid
1
0.8
0.6
0.4
0.2
0
-0.2
-0.4
0
2
4
6
8
10
12
14
16
18
20
Figure 6 – e− 0.2xsin(x)
Page 6
ETN3046 Analog & Digital Communications
To save the contents of the Editor, select File -> Save File from the Editor menu bar. A Save file as:
dialogue box appears. Select a directory and enter a file name, which must have the extension .m, in the File
name: box, e.g. junk.m. Click on Save. The Editor window now has the title junk.m. If you make subsequent
changes to junk.m in the Editor, an asterisk appears next to its name at the top of the Editor until you save
the changes.
When you run a script, you have to make sure that GNU Octave’s current directory (indicated in the
Current Directory field on the right of the desktop toolbar) is set to the directory in which the script is saved.
To change the current directory, type the path for the new current directory in the Current Directory field, or
select a directory from the drop-down list of previous working directories.
E) EXPERIMENT PROCEDURES – GNU Octave
1. Open and start the GNU Octave program by double-clicking the GNU Octave icon.
2. Type the command in the COMMAND WINDOW or create a script file in the EDITOR.
3. Analyze the following bask function for creating BASK modulated signals:
function bask(b,f)
% b is the input binary bit stream
% f is the frequency of the carrier
n = length(b); % determine the length of bit stream
t = 0:0.01:n-0.01;
% time axis
for i = 1:n
bw( ((i-1)*100)+1 : i*100 ) = b(i); % loop
end
carrier = cos(2*pi*f*t); % carrier signal
modulated = bw.*carrier; % modulated signal
subplot(3,1,1)
plot(t,bw)
grid on ; axis([0 n -2 +2])
subplot(3,1,2)
plot(t,carrier)
grid on ; axis([0 n -2 +2])
subplot(3,1,3)
plot(t,modulated)
grid on ; axis([0 n -2 +2])
Note: Always use the HELP function to assist you in understanding a MATLAB built-in
function/command, e.g. typing ‘help cos’ at the command prompt will return you an explanation on the
built-in function cos( ).
Next, using the above bask function with appropriate input values for b and f to plot: 1) the time domain
waveforms of an unipolar NRZ binary bit stream m1(t) as shown below, 2) a carrier signal of s1(t) = cos
(10t), and 3) the BASK modulated signal.
m1(t)
Binary code
1
0
1
0
1
1V
0V
1
2
3
4
5
t/s
Page 7
ETN3046 Analog & Digital Communications
4. Create a new function bfsk by modifying the bask function to plot: 1) the polar NRZ bit stream m2(t) as
shown below, 2) a carrier with frequency c = 10t, 3) a BFSK modulated signal xc(t) with frequency
deviation, = 5t. Mathematically, the BFSK modulated signal is given by:
cos(10t  5t )
x c (t )  
cos(10t  5t )
symbol "0"
symbol "1"
m2(t)
Binary code
1
0
1
0
1
+1V
−1V
1
2
3
4
5
t/s
Hint: You may need to use the if function; typing ‘help if’ in the command window to find out more.
5. Based on the same polar NRZ bit stream used in the above procedure create a new function bpsk that
plots 1) the polar NRZ bit stream m2(t) as shown above, 2) a carrier with frequency c = 10t, 3) the
BPSK signal with the following expression:
 A cos(10t   )
x c (t )  
 A cos(10t )
symbol "0"
symbol "1"
6. Consider the following 16 QAM transmission through an Additive White Gaussian Noise (AWGN)
channel.
Random Bit
Generator
Symbol
Mapping
16 QAM
Modulator
AWGN
16 QAM
Demodulator
% Create a random digital message
M = 16;
% Alphabet size
x = randi([0 M-1],100000,1); % Random symbols
% Use 16-QAM modulation.
hMod = qammod(x, M);
% Create a constellation diagram object.
figure;
plot(real(hMod), imag(hMod), 'x');
axis ([-4.5 4.5 -4 4])
EbN0 = 20;
% Transmit signal through an AWGN channel.
ynoisy = awgn(hMod,EbN0,'measured');
% Create constellation diagram from noisy data.
figure;
Page 8
ETN3046 Analog & Digital Communications
plot(real(ynoisy), imag(ynoisy), 'x');
axis ([-4.5 4.5 -4.5 4.5])
% Demodulate ynoisy to recover the message.
z = qamdemod(ynoisy, M);
% Check symbol error rate.
[num,rt] = symerr(x,z)
7. Evaluate the impact of the Eb/N0 parameter on the Bit Error Rates (BER). You can vary the Eb/N0 (e.g.
10, 12 and 14), compute the respective BER and comment on the changes observed. Explain the
differences if any.
F) Guidelines for Report Writing
A written report should be prepared based on the above experiment using the following guidelines:
1. Lab Experiment Overview
 Introduction to the experiment
 Summary of the lab experiment
 Maximum 1 page
2. Results and Observation
 Explain the results gathered from the experiment
 Answer all questions listed in the experiment
3. Conclusion and Discussion
 Conclusive remarks on the experiment
4. Appendices
 Any attachment if available
5. Prepare individual lab report using the cover page on next page.
Page 9
ETN3046 Analog & Digital Communications
FACULTY OF ENGINEERING
LAB REPORT FOR EXPERIMENT ADC2
ETN3046
ANALOG AND DIGITAL COMMUNICATIONS
TRIMESTER 1 SESSION 2018/2019
Criteria
0.25 (poor)
0.5 (need
improvement)
0.75
(Satisfactory)
1 (good)
Rating Award
by Assessor
Preparation
1
Read through the lab sheet
and understand the
objective of the
experiment. Able to run
MATLAB successfully.
2
Able to simulate ASK, PSK,
and FSK signals.
Able to simulate the scatter
plot for 16-QAM and obtain
the BER results of 16-QAM
for a range of Eb/N0 values.
Conducting the Experiment
3
Report Writing
4
5
Present results clearly,
discuss the and summarize
the findings coherently.
Write a good technical
report with good logical
flow and minimal
grammatical errors.
Student Name: ………..………………………………………………………………
Student ID:
………………………………
Lab Group No.: ………………………………
Degree Major: EE / CE / NE / LE / ME / OPE
Declaration of originality:
I declare that all sentences, results and data mentioned in this report are from my own work. All work derived
from other authors have been listed in the references. I understand that failure to do this is considered
plagiarism. I agree that this report will be given 0 marks if any words/photos in this report are copied from
others’.
Student signature: …………………………………………
Page 10
Download