程序代写案例-ELEC6258
时间:2021-11-15
ELEC6258 Simulation of Mobile Communications
Carrier Modulation Coursework
Submission Details
This assignment forms your assessment for the second part of “ELEC6258 Simulation of Mobile
Communications” and contributes 30% of your mark for that module.
You are required to produce a write-up, which needs to include the Matlab code, figures,
calculations and text that are directly requested in the “Questions” Sections below. Each
figure in your write-up should have well labelled axes and a relevant title or legend that
identifies which signals are shown. Although you may verbally discuss your ideas with your
classmates, you should not show them your Matlab code, figures, calculations or text.
When you are finished, you need to submit your write-up electronically at C-BASS
https://handin.ecs.soton.ac.uk/handin/2122/ELEC6258/2/
before 4pm on Tuesday 07/12/2021. You only need to make an electronic submission.
The marks distribution for each question is shown next to the question number below, where
the marks add up to 30.
If you notice any mistakes in this document or have any queries about it, please email me at
meh@ecs.soton.ac.uk.
Mohammed El-Hajjar
Learning Outcomes
1. Provide an introduction to fundamental research methods and techniques used in Wireless
Communications;
2. Develop sufficient skills in Matlab to implement and characerise wireless communication
schemes;
3. Simulate various components of analogue and digital communication systems in Matlab;
4. Produce high quality technical writing such as reports and reviews.
1
Table 1: Marking Scheme
Accuracy of results: Are the obtained results correct? Is the formulation
correct? Are the plots accurate? Do you include all required plots?
50%
Interpretation of results: How well are the questions posed in the assignment
answered? Do you answer all parts of the questions? Do you include the
required derivations? Do you explain your derivations when requested?
30%
Presentation of results: How well are the plots labelled and their contents
discussed? Do you include all correct labels? Do you use the right label units?
Do you explain your results when requested?
20%
1 Analogue Modulation
1.1 Double SideBand Suppressed Carrier Modulation [4.5 marks]
When a Radio Frequency (RF) signal is placed onto the antenna of a transmitter, it will
propagate through the air and can be detected on the antenna of a receiver. The higher the
frequency of this signal, the smaller the antennas that are required. However, we are often
interested in communicating relatively low frequency signals, such as audio. Hence, we must
modulate our low frequency signal onto a high frequency carrier, in order to transmit it.
Figure 1 shows the schematic of a transmission scheme that uses Double SideBand Suppressed
Carrier (DSBSC) modulation to transmit an input signal x(t) and then demodulation to obtain
a received signal xˆ(t).
×
cos(2pifct)
x(t) y(t) ×
2 cos(2pifct)
u(t)
LPF
xˆ(t)
Modulator Demodulator
Figure 1: DSBSC modulation and demodulation.
As shown in Figure 1
y(t) = x(t) cos(2pifct), (1)
u(t) = 2x(t) cos(2pifct) cos(2pifct). (2)
Using the trigonometric identity 2 cos(θ) cos(θ) = 1 + cos(2θ), we get
u(t) = x(t) (1 + cos(4pifct)) , (3)
= x(t) + x(t) cos(4pifct). (4)
2
1.1.1 Input Signal
For our input signal x(t), we shall employ a normally distributed random signal that has been
band-limited to a maximum frequency of fmax = 30 kHz.
Let’s start by generating a normally distributed random signal xw(t) and then band-limit it
later. We’ll simulate the analogue signal xw(t) over an interval of T = 0.4 seconds, using a high
sampling rate of fs = 2 MHz. Thus, the first step in your code is to use the commands:
f s=2000000;
T=0.4;
samples=f s*T;
t=(0:(samples-1))/f s;
It is recommended that you write your code into a new Matlab .m file, where you should use
this .m file throughout Section 1.1. This way, you’ll be able to modify it when you get to
Section 1.3, making things much easier for you.
You can generate a random analogue signal xw(t) by putting the commands
randn(’seed’,3);
x w=randn(size(t));
into your .m file. Here, we have seeded the random number generator, which will
ensure that you’ll get the same sequence of random numbers every time you run
your .m file. This will make it easier for you to keep your results self-consistent in
your write-up (and make it easier for me to mark it!)
Note that you can look up any unfamiliar Matlab commands and their parameters using Mat-
lab’s help facility. For example, in Matlab’s command window type “help randn” to obtain
information on how to create a Gaussian distributed random variable.
You can plot the first 1500 samples of the signal xw(t) by putting the commands
figure;
plot(t(1:1500),x w(1:1500));
into your .m file and running it. Use the ‘insert’ menu in the resultant figure to add relevant
labels to the x and y axes of this plot, as well as a relevant title. You should do this for all
of the plots generated in this assignment.
The signal xw(t) is said to be white. This means that it contains components at all frequencies.
You may check this by using the pwelch Matlab function, which displays the signal’s Power
Spectral Density (PSD). Simply put the commands
figure;
pwelch(x w);
into your .m file and run it. Change the title of the resultant figure so that it indicates which
signal the PSD relates to.
However, we require a signal that does not contain any components above a frequency of
fmax = 30 kHz. We can eliminate these components from xw(t) using a Low-Pass Filter (LPF).
Matlab’s fir1 function can be used to design an LPF. Take a look at the help that Matlab
offers for this function using the command
help fir1
3
This tells us that the command
B=fir1(N,W n);
designs an Nth order LPF and returns the N + 1 filter coefficients in a vector B. The normalised
cut-off frequency W n must be in the range 0 < W n < 1, with 1 corresponding to half the
sampling frequency fs. A filter order of N = 1023 is a good choice, but it’s up to you to
work out what value to use for W n, with consideration of fmax and fs.
The signal xw(t) can be filtered to obtain x(t) using the command
x=filter2(B,x w);
Plot the first 1500 samples of the signal x(t) and generate its PSD using the plot and pwelch
functions, as before. Observe that the high frequency components of x(t) have been attenuated
by about 80 dB compared to the low frequency components.
Questions
1. Export the plots and PSDs of the signals xw(t) and x(t) as .jpg images and include these
in your write-up.
2. Comment on the differences between the two signals xw(t) and x(t) and between their
PSDs.
3. Explain the calculation you used to choose the normalised cut-off frequency W n for the
LPF.
1.1.2 Modulation
Create a carrier c(t) with frequency fc = 200 kHz using the commands
f c=200000;
c=cos(2*pi*f c*t);
Plot the first 1500 samples of this carrier c(t) using the plot function, as before. You may like
to use the zoom button in the resultant figure to take a closer look at the carrier wave. Also,
generate the PSD of c(t) using the pwelch function, as before.
Next, we need to multiply the carrier c(t) with the input signal x(t) in order to obtain the
DSBSC signal y(t), as shown in Figure 1. You can do this using the command
y=c.*x;
Note that we must use the element-wise multiplication (.*) rather than the vector multiplication
(*) of c and x. Again, plot the first 1500 samples of this DSBSC signal y(t) and generate its
PSD using the plot and pwelch functions, as before.
Questions
1. Include the new plots and PSDs in your write-up.
2. Comment on how the plots of x(t) and c(t) may be combined to obtain that of y(t).
Similarly, comment on how the PSD of y(t) may be obtained by combining those of x(t)
and c(t).
4
3. What is the bandwidth of y(t) in Hertz? How does this compare to the maximum fre-
quency in x(t), namely fmax?
1.1.3 Demodulation
Take a look at the demodulator in Figure 1. Notice that it doesn’t use any components that
we haven’t already considered.
Start by transforming y(t) into u(t). You can use similar Matlab code to that which transformed
x(t) into y(t), as shown in Figure 1. Plot the first 1500 samples of the signal u(t) and generate
its PSD using the plot and pwelch functions, as before. Note that an image signal has arisen
in the PSD.
This image signal can be removed using the LPF shown in Figure 1. With consideration to the
PSD of u(t), choose a normalised cut-off frequency W n for this LPF that is half-way between
the desired signal and the image signal. A filter order of N = 23 will be sufficient for this LPF.
Obtain the reconstructed signal xˆ(t) and compare its first 1500 samples to those of x(t) using
the commands
figure;
plot(t(1:1500),xhat(1:1500),’-’, t(1:1500),x(1:1500),’--’);
Here, the parameter ’-’ tells Matlab to plot xˆ(t) using a solid line, while the parameter ’--’
results in a dashed line for x(t). Make sure you are happy that xˆ(t) and x(t) are very similar.
Also, generate the PSD of xˆ(t) using the pwelch function, as before.
Questions
1. Include the new plots and PSDs in your write-up.
2. Explain the calculation you used to choose the normalised cut-off frequency W n for the
LPF.
1.2 Frequency Division Multiplexing [5 marks]
Frequency-division multiplexing (FDM) is widely used in communications, where FDM plays
an important role in the OFDM technique used in DSL and in the fourth-generation mobile
communications systems.
Suppose x1(t) and x2(t) are two message signals and let f1 and f2 be their corresponding
sub-carrier frequencies as shown in Figure 2. We can form the modulated sub-carrier signals
as:
y1(t) = x1(t) cos(2pif1t)
y2(t) = x2(t) cos(2pif2t).
5

×
cos(2pif1t)
x1(t)
x2(t)
y(t)
× LPF
cos(2pif2t)
× LPF
2 cos(2pif1t)
u1(t) xˆ1(t)
xˆ2(t)u2(t)
2 cos(2pif2t)
Modulator Demodulator
Figure 2: FDM modulation and demodulation.
Note that the subcarrier frequencies f1 and f2 must be spaced sufficiently apart in frequency
so that the spectra of y1(t) and y2(t) do not overlap. Then, using FDM, the signals y1(t) and
y2(t) are combined to give
y(t) = y1(t) + y2(t).
The demodulation of the two signals x1(t) and x2(t) can be done as shown in Figure 2, where
the LPF should be designed carefully in terms of the cutoff frequency as well as the filter order.
1.2.1 Input Signal
Similarly to Section 1.1, for our input signals x1(t) and x2(t), we shall employ normally dis-
tributed random signals that has been band-limited to a maximum frequency of fmax1 = 10 kHz
and fmax2 = 15 kHz, respectively.
Similarly to Section 1.1, we will generate normally distributed random signals and then band-
limit them. Hence, start by simulating the analogue signals xw1(t) and xw2(t) over an interval
of T = 0.1 seconds, using a high sampling rate of fs = 2 MHz.
You can use the .m file you produced in Section 1.1, rename it and modify it accordingly. You
can generate a random analogue signal xw1(t) and xw2(t) by putting the commands
randn(’seed’,2);
x w1=randn(size(t));
randn(’seed’,15);
x w2=randn(size(t));
into your .m file. Please make sure you use the same ‘seed’ as in the code above.
Plot the first 1000 samples of the signal xw1(t) and xw2(t). Add relevant labels to the x and y
axes of this plot, as well as a relevant title.
Plot the PSD of the signals xw1(t) and xw2(t) and show that they are white.
6
However, we require signals x1(t) and x2(t) that do not contain any components above a
frequency of fmax1 = 10 kHz and fmax2 = 15 kHz, respectively. Eliminate these components
from xw1(t) and xw2(t) using a Low-Pass Filter (LPF) as in Section 1.1.
Plot the first 1000 samples of the signal x1(t) and x2(t) and generate their PSD using the plot
and pwelch functions, as before.
Questions
1. Export the plots and PSDs of the signals xw1(t), xw2(t), x1(t) and x2(t) as .jpg images
and include these in your write-up.
1.2.2 Modulation
Create a carrier c1(t) with frequency f1 = 250 kHz. Generate the PSD of c1(t) using the pwelch
function, as before.
For the FDM, we need to generate another carrier signal c2(t) with an appropriate carrier
frequency f2 so that the two signals y1 and y2 do not overlap. Let us choose f2 = 280 kHz.
Next, we need to multiply the carrier c1(t) with the input signal x1(t) in order to get a DSBSC
signal y1(t) and the carrier c2(t) with the input signal x2(t) in order to get the DSBSC signal
y2(t). Then we add y1(t) and y2(t) in order to get our FDM signal y(t).
Again, plot the first 1000 samples of the signals y1(t), y2(t) and y(t) and generate their PSD
using the plot and pwelch functions, as before and make sure you label the figures properly.
Questions
1. Export all the new plots and PSDs and include these in your write-up.
2. Comment on how you we can choose the carrier frequencies f1 and f2. In the case
of the input signals x1(t) and x2(t) characterised above, can we use f2 = 260 KHz if
f1 = 250 kHz? Explain your answer.
3. What is the bandwidth of y1(t), y2(t) and y(t) in Hertz? How do these compare to the
maximum frequency in x1(t) and x2(t), namely fmax?
1.2.3 Demodulation
The demodulation of the FDM signal y(t) can be implemented as shown in Figure 2.
Start by transforming y(t) into u1(t) and u2(t). Plot the first 1000 samples of the signals u1(t)
and u2(t) and generate their PSDs.
7
The image signal can be removed using the LPF shown in Figure 2. You can use the same
Matlab functions you used in the previous section to apply the LPF. As discussed before, you
need to carefully select a cut-off frequency and filter order in order to be able to recover the
signals.
Plot the reconstructed signals xˆ1(t) and xˆ2(t) and compare its first 1000 samples to those of
x1(t) and x2(t). Also, generate the PSD of xˆ1(t) and xˆ2(t).
Questions
1. Include the new plots and PSDs in your write-up and explain the PSDs.
2. Explain the PSD of u1(t) and u2(t). Explain how you selected the filter order and the
calculation you used to choose the normalised cut-off frequency W n for the LPF.
3. Is x1(t) identical to xˆ1(t)? Is x2(t) identical to xˆ2(t)? Explain any differences between
x1(t) and xˆ1(t) and also between x2(t) and xˆ2(t) and suggest how you can fix this?
1.3 Quadrature Amplitude Modulation [4 marks]
The cosine and sine functions are orthogonal to each other, hence a signal xi(t) that is ampli-
tude modulated onto a cosine carrier wave will not interfere with another signal xq(t) that is
modulated onto a sine carrier wave having the same frequency fc. We refer to these signals
as the in-phase signal xi(t) and the quadrature-phase signal xq(t). The additional presence
of the quadrature-phase signal gives Quadrature Amplitude Modulation (QAM) its name. A
schematic for a QAM scheme is shown in Figure 3
y(t)
Demodulator
2 sin(2pifct)
uq(t) xˆq(t)
LPF
×
2 cos(2pifct)
ui(t)
LPF
xˆi(t)
×
+
Modulator
×
cos(2pifct)
xi(t)
sin(2pifct)
×xq(t)
Figure 3: QAM modulation and demodulation.
As shown in Figure 3
y(t) = xi(t) cos(2pifct) + xq(t) sin(2pifct), (5)
ui(t) = 2xi(t) cos(2pifct) cos(2pifct) + 2xq(t) sin(2pifct) cos(2pifct), (6)
uq(t) = 2xq(t) sin(2pifct) sin(2pifct) + 2xi(t) cos(2pifct) sin(2pifct). (7)
8
Using the trigonometric identities 2 cos(θ) cos(θ) = 1+cos(2θ), 2 sin(θ) sin(θ) = 1−cos(2θ) and
2 cos(θ) sin(θ) = sin(2θ), we get
ui(t) = xi(t) + xi(t) cos(4pifct) + xq(t) sin(4pifct), (8)
uq(t) = xq(t)− xq(t) cos(4pifct) + xi(t) sin(4pifct). (9)
After the high-frequency components of ui(t) and uq(t) are removed by the LPFs shown in
Figure 3, we obtain
xˆi(t) = xi(t), (10)
xˆq(t) = xq(t), (11)
as desired.
For our input signals xi(t) and xq(t), we shall employ a normally distributed random signal
that has been band-limited to a maximum frequency of fmax = 30 kHz.
Modify the Matlab .m file you wrote for Section 1.1 in order to simulate the scheme of Figure 3.
You can generate xi(t) and xq(t) in a similar manner to how you generated x(t) in Section 1.1,
by using the commands
randn(’seed’,3);
x w = randn(size(t));
x i = filter2(B,x w);
x w = randn(size(t));
x q = filter2(B,x w);
Note that by regenerating xw(t) before obtaining xq(t), we ensure that it differs to xi(t).
In this exercise we will use a carrier frequency of fc = 250 KHz. You can obtain y(t) by using
the commands
c i=cos(2*pi*f c*t);
c q=sin(2*pi*f c*t);
y=c i.*x i+c q.*x q;
You can obtain ui(t) and uq(t) in the same way that you obtained u(t) in Section 1.1. These
signals can be filtered using the same LPF as the one you used in Section 1.1.
Generate the PSD of y(t) in the same way that you did in Section 1.1. Also, plot the first 1000
samples of xi(t) and xˆi(t) in the same figure, like you did in Section 1.1. Do the same for xq(t)
and xˆq(t). Make sure that you are convinced that QAM allows the transmission of two signals
at the same time.
Questions
1. Include the PSD and one of the new plots in your write-up.
2. With consideration of the PSD, explain how the bandwidth of y(t) compares to that
obtained for the DSBSC scheme in Section 1.1? This may seem surprising since the
DSBSC scheme only transmits one signal, whereas the QAM scheme transmits two. If
not in bandwidth, how does the QAM scheme ‘pay’ for the additional signal?
9
1.4 Complex Quadrature Amplitude Modulation and Additive White
Gaussian Noise [2.5 marks]
Note that just like how our signal comprises the two components xi(t) and xq(t), there are
two components to a complex number, namely the real part and the imaginary part. Complex
numbers can therefore conveniently represent the two parts of our signal, according to
x(t) = xi(t) + jxq(t), (12)
where j =
√−1. In this case, the schematic of Figure 3 is transformed into that of Figure 4.
y(t) × u(t) LPF xˆ(t)
Demodulator
×x(t)
Modulator
Re(·)
e−j2pifct 2ej2pifct
Figure 4: Complex QAM modulation and demodulation.
As shown in Figure 4
y(t) = Re
[
x(t)e−j2pifct
]
, (13)
where Re[a+ jb] = a.
Additive White Gaussian Noise: So far, we’ve assumed that our channel does not ad-
versely affect our transmitted signal y(t). Let’s see how our analogue modulation scheme
performs when the channel introduces some Additive White Gaussian Noise (AWGN) n(t), as
shown in Figure 5.
×x(t)
Modulator
Re(·)
e−j2pifct
+
yˆ(t) × u(t) LPF xˆ(t)
Demodulator
2ej2pifct
y(t)
n(t)
Figure 5: Complex QAM modulation and demodulation in the presence of AWGN.
This noise n(t) is additive because it is added to the transmitted signal y(t). It is Gaussian
because it may be generated using a sequence of Gaussian distributed random variables, just
like how our signal xw(t) was generated in Section 1.1a. As described in Section 1.1, sequences
of Gaussian distributed random variables have components at all frequencies. Therefore, our
noise n(t) is white.
Modify your .m file from Section 1.3 in order to simulate the scheme of Figure 5. Generate the
noise n(t) using the commands
10
randn(’seed’,1);
n=0.01*randn(size(t));
Here, the multiplier of 0.01 results in some relatively low-power noise. Here are some other
commands to help you simulate the scheme of Figure 5
x=x i+j*x q;
yhat=real(x.*exp(-j*2*pi*f c*t))+n;
u=2*yhat.*exp(j*2*pi*f c*t);
Compare plots of the transmitted and received signals using the commands
figure;
plot(t(1:1000),real(xhat(1:1000)),’-’, t(1:1000),real(x(1:1000)),’--’);
figure;
plot(t(1:1000),imag(xhat(1:1000)),’-’, t(1:1000),imag(x(1:1000)),’--’);
Also, generate PSDs for the two components of the received signal.
Questions
1. Include the plots and the PSDs in your write-up.
2. Comment on how the AWGN has affected the demodulated signals.
3. Comment on how the PSD compares to that obtained for xˆ(t) in Section 1.1.
How has this PSD been affected by your choice of the cut-off frequency for the LPF of
Figure 5? Comment on how this would influence your choice of cut-off frequency in the
future.
2 Digital Modulation
2.1 Amplitude Shift Keying [5 marks]
Amplitude-shift keying (ASK) is the simplest form of digital modulation. We will use it to
provide an introduction to digital communications.
ASK is simply ‘amplitude modulation’ with a binary message waveform. To illustrate, suppose
m(t) is a binary message, where a binary 1 is represented by a pulse of amplitude +1 and a
binary 0 by a pulse of amplitude −1. Each pulse has a duration of Tp seconds. Let us define
an AM signal as:
y(t) = A(1 +m(t))cos(2pifct), (14)
where fc is the carrier frequency and A is the carrier amplitude. It is evident in Equation (14)
that either y(t) = 2Acos(2pifct) or y(t) = 0 , depending on whether the corresponding message
bit is a 1 or a 0. Thus the carrier is turned “on” to transmit a 1 and “off” to transmit a 0.
This mode of ASK is sometimes referred to as “on-off” keying.
The pulse duration Tp is the “symbol time” and the “symbol rate” is then 1/Tp. In a binary
modulation method such as 2ASK, the symbol rate and the bit rate are identical.
11
Several steps are needed to produce an ASK modulated signal as follows:
1. Bit Mapping: The input data arrives as a stream of bits. In the symbol mapping step,
the bits are replaced by numerical values. For ASK we will represent a binary 1 by the
symbol +1 and a binary 0 by the symbol −1.
Let’s consider a scheme that transmits bits at a rate of fb = 25 kbit/s. Start by adding
the following commands into the .m file you created in Section 1.4.
f b=25000;
bits=f b*T;
You can generate a random bit sequence b[n] using the commands
rand(’seed’,30);
b=round(rand(1,bits));
You may like to look up the rand and round functions in Matlab’s help facility to see
how this works.
You can determine the symbol rate fsymb, the total number of symbols and the number
of samples per symbol using the commands
bits per symbol=?;
f symb=f b/bits per symbol;
symbols=bits/bits per symbol;
samples per symbol=f s/f symb;
You need to include the correct value for the bits per symbol.
We need to map each bit to a ASK symbol in order to generate the symbol sequence s[n].
Write a Matlab code to map a bit 1 to symbol +1 and bit 0 to symbol −1. You may use
the following code:
sn = a*(2*b-1);
You can check that the average symbol power is normalised to 1 in this way using the
command
sum(abs(sn).∧2)/symbols
Questions
(a) What is the value of bits per symbol?
(b) Output the first five values in your resultant symbol sequence s[n] using the command
sn(1:5). Comment on how the bit values b relate to the corresponding values in s[n].
(c) Derive an expression for the value of a used in the code for sn above, that correctly
normalises the average symbol power and include this in your write-up
2. Upsampling: We will see below that the symbols are carried on pulses whose shape is
important in establishing the bandwidth of the transmitted signal. As a first step toward
replacing symbols by pulses, we will place L− 1 zeroes after each symbol. This produces
a sample interval of
Tx =
Tp
L
(15)
or a sample rate of
1
Tx
= L
1
Tp
(16)
12
A higher upsampling factor L makes the D/A conversion in the transmitter easier, but
requires faster signal processing. The “upsample” function can be used to implement this
step. Read the Matlab help about the “upsample” function and write the code
to upsample s[n].
Figure 6: Symbol sequence.
Figure 7: Upsampled symbol sequence.
Figure 8: Filtered upsampled symbol sequence.
3. Pulse Shaping: If the upsampled signal is applied to a filter whose impulse response is a
rectangular pulse of unit amplitude and length L samples, then at the filter output, each
symbol will be represented by a rectangular pulse. Figures 6, 7 and 8 show the effect
of upsampling and filtering. Figures 6 represents the symbol sequence, with symbols
occurring every Tp seconds. Figures 7 shows the symbol sequence after upsampling and
Figures 8 shows the upsampled symbol sequence after filtering by the rectangular pulse-
shaping filter.
13
As discussed before, the next step is to convert the sequence of discrete ASK symbols s[n]
into a continuous function of time s(t). This can be done by generating impulses, which
are then up-sampled and filtered using a pulse shaping filter.
First, we will use rectangular pulse shaping, where you can employ the up-sampling and
the pulse shaping using the following command:
s t = rectpulse(sn,samples per symbol);
Questions
(a) Plot the first 1000 samples in s(t). Make sure that you show how these plots relate
to the first 10 bits of b[n] as well as the first 10 values in s[n] and comment on this.
(b) Plot the PSDs for the s(t).
(c) Comment on how the signals s(t) and s[n] are related. What is the maximum
frequency that is present within the signal s(t)? How does this compare to the
symbol rate fsymb?
4. Modulation: s(t) represents the message waveform at the transmitter filter output, then
the next step is to apply modulation:
y(t) = A(1 + s(t))cos(2pifct). (17)
Simulate the transmission of your signal s(t) using Equation (17) using a carrier frequency
of 250 kHz.
Questions
(a) Evaluate the required value of A that produces a modulated signal with average
power of 1.
(b) Plot the PSD of y(t). State the bandwidth of y(t) in your write-up.
5. Demodulation: In this exercise, we will use envelope detection to recover the ASK mod-
ulated signal. The envelope detection can be done by evaluating the envelope of the
received signal followed by low-pass filtering.
In order to evaluate the envelope of the ASK modulated signal, you can use the Matlab
abs() function, which evaluate the square of the envelope. Hence, you need to use
the Matlab square-root sqrt() function in order to get the envelope. You can use the
following command:
sqrt(abs(--));
Then a LPF similar to the one you used in the previous questions can be used in order
to filter the envelope of the received signal.
After filtering, you should remove the offset in your signal, which is due to the modulation
performed in Equation (17). Let us call the generated signal at this point sˆ(t)
Next, we need to sample sˆ(t) at the midpoints of the symbol durations. Sampling can be
performed using the following command:
snhat = intdump(sthat, samples per symbol);
After the demodulation, the recovered ASK symbols should be mapped to bits, which
can be done using the following command:
14
bhat = snhat > 0;
Now, we need to compare the decoded bits with the transmitted bits in order to make sure
that our modulation/demodulation process was successful. We can do this by evaluating
the Bit Error Ratio (BER), which is obtained using the command
ber=sum(b hat∼=b)/bits;
Questions
(a) Plot the first 1000 values of s(t) and sˆ(t). Comment on your observations in the
figure.
(b) Plot the first 100 values of s[n] and sˆ[n]. Comment on your observations in the
figure.
(c) State the BER value you obtained.
2.2 4-ary Quadrature Amplitude Modulation [9 marks]
As we showed in Section 1, analogue modulators transmit an analogue signal x(t). However,
the analogue demodulator can never be sure if a particular component of the demodulated
signal xˆ(t) is signal or noise. By contrast, digital modulators transmit digital signals, such as a
sequence of binary digits b[n]. Since a bit can only have a value of ‘0’ or ‘1’, the demodulator
just has to choose from these two values when recovering the sequence bˆ[n].
We can construct a digital modulation scheme by converting the digital signal b[n] into an
analogue signal x(t) and using the analogue modulation scheme of Figure 5. Once the demod-
ulated signal xˆ(t) has been recovered, we just need to convert it back into a digital signal bˆ[n].
Schematics for a Digital to Analogue Converter (DAC) and an Analogue to Digital Converter
(ADC) are provided in Figures 9 and 10.
Serial to
parallel
converter
4QAM
mapper
Root raised
cosine filter
b[n]
b1[n]
b2[n]
s[n] s(t) x(t)impulse
generator
Figure 9: Digital to analogue conversion using 4QAM.
Root raised
cosine filter
bˆ[n]
bˆ1[n]
bˆ2[n]
sˆ[n]sˆ(t)xˆ(t)
sampler 4QAMdemapper
Parallel to
serial
converter
Figure 10: Analogue to digital conversion using 4QAM.
Several steps are needed to produce an digitally modulated signal as follows:
1. Bit mapping: You can use the code you produced in Section 2.1 and modify it according
to the requirements of this section.
15
Here, we will consider a scheme that transmits bits at a rate of fb = 20 kbit/s. Generate
a sequence of bits as in Section 2.1, but here using rand(’seed’,1).
Let’s use M = 4-ary Quadrature Amplitude Modulation (4QAM), like in Figures 9 and
10. This transmits log2(M) = 2 bits at a time by combining them into a single 4QAM
symbol. Determine the symbol rate fsymb, the total number of symbols and the
number of samples per symbol as in Section 2.1.
As shown in Figure 9, the first step in 4QAM modulation is to convert our serial sequence
of bits b[n] into two parallel sequences b1[n] and b2[n]. You can do this using the commands
b mat=reshape(b,bits per symbol,symbols);
b 1=b mat(1,:);
b 2=b mat(2,:);
Verify that this works by comparing the first 10 bits in b[n] (use the command
b(1:10)) with the first 5 bits in b1[n] and b2[n] (use the commands b 1(1:5) and
b 2(1:5)). Notice that the bits in b[n] having even indices go into one of the parallel bit
sequences, while the bits with odd indices go into the other.
Next, we need to map each pair of bits to a 4QAM symbol, in order to generate the symbol
sequence s[n], as shown in Figure 9. Like in the complex QAM scheme of Section 1.4, the
4QAM symbols are complex. You can do the mapping using the command
sn=a*(-2*(b 1-0.5)+j*-2*(b 2-0.5));
Here, you need to choose the value for a that results in an average symbol power of
one. You can check that the average symbol power is normalised in this way using the
command
sum(abs(sn).∧2)/symbols
Output the first five values in your resultant symbol sequence s[n] using the
command sn(1:5). Make sure that you can see how the bit values in b1[n] and b2[n]
relate to the corresponding complex values in s[n]. The possible values of the 4QAM
symbols in s[n] can be visualised using the constellation diagram of Figure 11.
Im(s[n])
a−a
a
−a
Re(s[n])
Figure 11: 4QAM constellation diagram.
The bit mapping we have used is called the Gray bit mapping. Table 2 would detail this
16
bit mapping, but it is incomplete.
b1[n] b2[n] s[n]
0 0
0 1
1 0
1 1
Table 2: 4QAM Gray bit mapping
Questions
(a) What are the values of bits per symbol, symbol rate, the number of symbols and
the number of samples per symbol you used?
(b) Include the 10 bits and their corresponding symbol values that you observed in your
write-up.
(c) Include a table like Table 2 in your write-up and fill in the missing complex values
of s[n] by examining the provided Matlab code.
(d) Comment on how the distance between the various pairs of constellation points in
Figure 11 is related to how similar their mapped bit values are. Comment on why
this is beneficial.
2. Impulse generation: As shown in Figure 9, the next step is to convert our sequence of
discrete 4QAM symbols s[n] into a continuous function of time s(t). We can do this by
generating impulses having the corresponding complex amplitudes, as shown in Figure 9.
Since our symbols are generated at a rate of fsymb = 10
4 symbols/s, each one has a dura-
tion of 10−4 s. Let’s generate our impulses at the midpoints of these durations. Remember
that in our simulation, we are using samples to model the various continuous functions of
time. Hence, you can generate s(t) by up-sampling s[n] by samples per symbol times.
You can do this using the command
st=upsample(sn*samples per symbol,samples per symbol,samples per symbol/2);
Here, the third parameter ensures that the impulses occur at the midpoints of the symbol
durations.
Questions
(a) Plot the real and imaginary parts of the first 1000 samples in s(t). Make sure that
you can see how these plots relate to the first five bits of b1[n] and b2[n], as well as
the first five complex values in s[n].
(b) Plot the PSDs for the real and imaginary parts of s(t). With reference to your PSD,
comment on why it is necessary to apply a LPF to s(t) before modulating it onto
the channel.
3. Root raised cosine filtering: The root raised cosine filter of Figure 9 is a special type of
LPF that is particularly suited for digital modulation in the presence of AWGN. You can
generate a root raised cosine filter using the command
B rrcos=firrcos(10*samples per symbol,f symb/2,f symb,f s,’sqrt’);
Like in Section 1.1a, use the filter2 function to filter s(t) and generate the analogue
signal x(t).
17
Compare the real part of the signals s(t) and x(t) using the commands
figure;
plot(t(1:1000),real(x(1:1000)),’-’,
t(1:1000),real(st(1:1000))/samples per symbol,’--’);
Do the same for the imaginary part. Also, generate PSDs for the real and imaginary
parts of x(t).
Questions
(a) Include these plots and one of the PSDs in your write-up. Comment on how the
signals s(t) and x(t) are related.
(b) What is the maximum frequency that is present within the signal x(t)? How does
this compare to the symbol rate fsymb?
4. Modulation and demodulation: Use the Matlab code you wrote for Section 1.4 to simulate
the transmission of your signal x(t). Compare the real and imaginary parts of x(t) with
those of xˆ(t) using the commands provided in Section 1.4a. Confirm that these signals
are very similar and that they only differ because of the noise you introduced.
5. Root raised cosine filtering 2: As shown in Figure 10, the first step in obtaining bˆ[n] from
xˆ(t) is to filter it. This will remove some of the noise that was not filtered out by the
LPF of Figure 5. You should use the same root raised cosine filter that you designed
in the transmitter and you should use the filter2 function again. Compare the real
and imaginary parts of the resultant signal sˆ(t) with those of s(t) by using
commands similar to the one provided in step 3 above.
As shown in Figures 9 and 10, the impulses of s(t) pass through two root raised cosine
filters, one in the transmitter and one in the receiver. Figure 12 shows the impulse
response of this pair of filters. In the absence of any channel noise, the signal sˆ(t) can
be obtained by convolving s(t) with the response shown in Figure 12. This convolution
replaces each impulse in s(t) with a version of the impulse response shown in Figure 12
that has the corresponding complex amplitude.
Questions
(a) Include your new plots in your write-up.
(b) Explain the features of Figure 12 which show that the root raised cosine filters of
Figures 9 and 10 facilitate (i) a low bandwidth, (ii) a low filter order and (iii) no
inter symbol interference.
6. Sampling and 4QAM demapping: Next, we need to sample sˆ(t) at the midpoints of the
symbol durations, as shown in Figure 10. These midpoints coincide with the impulses
shown in the plots you just generated. You can sample sˆ(t) using the command
snhat=sthat(upsample(ones(size(sn)),
samples per symbol,samples per symbol/2)==1);
Output the first five values in the resultant sequence sˆ[n] using a command similar to
the one suggested in Step 1 above. Make sure that you can see how these five values are
obtained from sˆ(t) by comparing them with the plots you generated in Step 5 above.
As shown in Figure 10 the next step is 4QAM demapping. This can be performed by
seeing where the samples in sˆ[n] occur within the constellation diagram of Figure 11. More
specifically, we need to decide which constellation point is the nearest to each sample.
18
−0.2 −0.1 0 0.1 0.2
0
0.25
0.5
0.75
1
Time since impulse [ms]
N
or
m
al
ise
d
im
pu
lse
re
sp
on
se
Figure 12: Impulse response of a pair of root raised cosine filters.
For 4QAM, we can do this by seeing which side of the axes the samples are on. This can
be achieved using the commands
b 1hat=real(snhat)<0;
b 2hat=imag(snhat)<0;
Display the first five bits in the resultant sequences bˆ1[n] and bˆ2[n]. Make sure you can
see why these values have been selected for these bits by considering the first five values
in snhat.
The final step of Figure 10 is parallel to serial conversion. You can achieve this using the
commands
b mathat=[b 1hat;b 2hat];
b hat=reshape(b mathat,1,bits);
Display the first ten bits in the resultant sequence bˆ[n].
Questions
(a) Include the values of sˆ[n], bˆ1[n], bˆ2[n] and bˆ[n] that you observed in your write-up.
Comment on how these values compare to the ones you observed in Step 1 above.
(b) State the BER you observe. Comment on how the noise multiplier value can affect
the BER.
7. Rectangular Pulse shaping: Replace the root raised cosine pulse shaping filters in the
modulator and demodulator of your 4-QAM simulation by a rectangular pulse shaping
filter similar to the one you used in Section 2.1.
19
Questions
(a) Plot the spectrum of x(t) and then compare the spectrum of the transmitted signal,
when using rectangular filtering and root raised cosine filtering. Comment on the
difference in the bandwidth and the rate of spectral rolloff of the two cases.
20


























































































































































































































































































































































































































































































































































































































































































































































学霸联盟


essay、essay代写