Lab 06
Lab 06
Lab 06
Contents
0 Laboratory Objectives and Student Outcomes 2
0.1 Laboratory Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
0.2 Student Outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1 Background 3
1
0 Laboratory Objectives and Student Outcomes
0.1 Laboratory Objectives
This laboratory will assist students in understanding fundamental concepts pertaining to orthogonal fre-
quency division multiplexing (OFDM) communications systems. The activities focus on OFDM concepts
and principles that are utilized in modern wireless systems such as 802.11a/g/n/ac/ad WiFi systems, dig-
ital audio broadcasting (DAB), digital video broadcasting (DVB-T), and (combined with multiple access
techniques) in 4G LTE cellular phone systems. Students will use simulation to experiment with multicarrier
communication systems. The importance of FFT-based digital signal processing in OFDM systems will
be explored. Students will then examine key parameters and practical issues related to real-world OFDM
communication systems.
Explain how FFT-based processing in used for OFDM modulation and demodulation.
Identify and explain key parameters and characteristics of a real-world communication system that
utilizes OFDM.
2
1 Background
This laboratory concerns orthogonal frequency division multiplexing (OFDM) communication systems.
OFDM is a signaling technique in which data is transmitted in parallel using a large number of modu-
lated carriers. This approach allows for high rate communication over a wideband channel that is robust
against non-ideal channel characteristics such as frequency-selective fading and multi-path interference.
Consider a serial data stream having symbol interval Ts . Note that these symbols could be the result of any
form of digital modulation (e.g., BPSK, QPSK, 16-QAM). This data stream is converted to a parallel data
stream consisting of N symbols, each having interval T = N Ts . Each symbol is transmitted on one of N
orthogonal carriers. The complex envelope of the OFDM signal over each T second interval is
N
X −1
g(t) = A bn ej2πfn t (1)
n=0
where A is the carrier amplitude, bn is an element of the N -element parallel data vector, and the complex
exponentials represent the orthogonal carriers. The spacing between each carrier is 1/T Hz, which ensures
they are mutually orthogonal over the T second interval. This orthogonality allows the receiver to recover
the data on each carrier without interference from the other carriers.
3
2 Multicarrier Communication System Simulation
As described in Section 1, OFDM is a form of multicarrier communication where a serial data stream
is transmitted using a collection of orthogonal carrier signals. In this portion of the laboratory you will
construct a Simulink model for simulating the multicarrier nature of OFDM.
We will consider the OFDM communication signal described in Equation 1 for transmitting BPSK data at
the rate of 1000 bits per second using four carriers (referred to as subcarriers). Therefore, bn ∈ {−1, 1},
Ts = 1/1000, and N = 4. We will use subcarrier frequencies -375Hz, -125Hz, 125Hz, and 375Hz.
A Simulink model for the corresponding OFDM modulator is shown in Figure 2.
The BPSK Baseband Modulation block applies BSPK modulation to the serial message bits.
The Multiport Selector block acts as a serial-to-parallel converter. It separates each frame of 4
BPSK symbols into a separate signal. Set Select to Rows and set Indices to output to {1,2,3,4}.
4
Verify the flow of message symbols by adding a Time Scope block and running the simulation. You
will probably find it helpful to use a “stem” style plot.
3. Construct the Subcarrier 1 portion of the model.
The Ideal Rectangular Filter block will translate the incoming BPSK symbol into a rectangular
pulse of length T . In other words, the block holds the symbol value for the duration of the OFDM
symbol. Set the Pulse length to 8, set the Input processing for Columns as frames and set
the Rate options for Enforce single-rate processing. Note that the sampling rate of the
output signal is 8/T = 2000 Hz, since the output signal has 8 samples during the T = N Ts = 0.004
second OFDM symbol interval.
The Sine Wave block generates the subcarrier signal. Set the Frequency to -375, set the Output
complexity to Complex, set the Sample time to T /8, and set the Samples per frame to 8.
Given this sample rate and frame size, each frame corresponds to the OFDM symbol duration T ,
and therefore matches the output of the Ideal Rectangular Filter block. The output of the
Product is the modulated subcarrier.
Verify this portion of the model using Time Scope and Spectrum Analyzer blocks.
Construct the Subcarrier 2, Subcarrier 3, and Subcarrier 4 portions of the model using frequencies -
125 Hz, 125 Hz, and 375 Hz, respectively. Use an Add block to combine the modulated subcarriers
into the OFDM waveform.
Verify the model using Time Scope and Spectrum Analyzer blocks. The spectrum of the
OFDM signal should resemble the one shown in Figure 3
Figure 3: Example OFDM signal spectrum from Simulink model of multicarrier communication system.
5
Question 2.1: Use a Spectrum Analyzer block to simultaneously view each of the modulated
subcarriers (the four signals at the input of the Add block). Comment on the spectrum plots,
paying particular attention to the bandwidth and shape of each modulated subcarrier.
Question 2.2: Use a Spectrum Analyzer block to view the spectrum of the OFDM signal.
Comment on the spectrum plot. Measure the signal bandwidth (null-to-null).
Question 2.3: Expand the Simulink model by constructing a receiver that will recover the
serial data sequence. Include a screen capture of the Simulink model and explain the
configuration of each block in the receiver. Include screen capture(s) of a Time Scope block
showing that the data sequence is properly recovered.
Hint: Begin by constructing a receiver that recovers the portion of the message on one
subcarrier. Then, expand the receiver to recover the remaining message symbols from the other
subcarriers. Use a Vector Concatenate block to combine the four parallel data streams into a
single data sequence.
6
3 FFT Processing for OFDM Modulation and Demodulation
An important aspect of OFDM waveforms is that they can be generated using well-known and computation-
ally efficient digital signal processing algorithms. In particular, real-world implementations of OFDM utilize
the Discrete Fourier Transform
N
X −1
X[n] = x[k]e−j(2π/N )nk (2)
k=0
where k = 0, 1, . . . , N − 1. The Fast Fourier Transform (FFT) and Inverse Fast Fourier Transform (IFFT)
algorithms are computationally efficient ways of computing Equations 2 and 3.
We will now show that the complex envelope of an OFDM waveform can be computed using Equation 3.
Beginning with Equation 1 and choosing fn = n/T gives
N −1
n
X
g(t) = A bn ej2π T t
n=0
Let g[k] denote the time-domain sampled version of g(t) where N samples are taken over the T time interval.
Therefore,
g[k] = g(kT /N )
N −1
n
X
= A bn ej2π T (kT /N )
n=0
N
X −1
= A bn ej(2π/N )nk
n=0
for k = 0, 1, . . . , N − 1. Notice that the result exactly matches Equation 3 (except for the scaling factors)
where bn takes the place of X[n].
This result leads to the OFDM modulator concept shown in Figure 4. For each group of N data symbols
in the serial data stream bn , the serial-to-parallel converter creates the vector b = [b0 , b1 , . . . , bN −1 ] which
is then the input to the IFFT operation. The IFFT output vector g is then converted back to a serial
data stream, which becomes the N samples of the OFDM waveform for the T second symbol interval. The
demodulation process works similarly, but uses the FFT operation.
b- g
- -
-
bn -
- -
- g[k]
- Serial to Parallel
..
- IFFT ..
-Parallel to Serial -
.- .-
7
3.1 MATLAB Script
The MATLAB script shown in Figure 5 is included to help convince you that the FFT-based approach is
equivalent to the OFDM complex envelope in Equation 1. Carefully examine the MATLAB script in relation
to the equations presented in Section 3, and experiment with the calculations before continuing.
1 %% e x a m p l e _ O F D M _ B P S K . m
2 % Script showing equivalence of computing the OFDM envelope using the IFFT .
3 %
4 % Cory J . Prust , Ph . D .
5 % Last Modified : 8/24/2018
6
7 clear all
8 close all
9
10 %% Simulation parameters
11 N = 4; % number of subcarriers
12 Ts = 1/1000; % bit period of serial data stream
13 T = N * Ts ; % symbol period of OFDM data
14 n = 0:( N -1) ;
15 f = n/T; % vector of subcarrier frequencies
16 A = 1; % subcarrier amplitude
17
18 %% Generate N BPSK data symbols
19 data = 2* randi ([0 1] ,N ,1) -1;
20
21 %% Compute complex envelope using Equation 1
22 g = zeros (N ,1) ;
23 for ii =1: N
24 g = g + A * data ( ii ) * exp ( j *2* pi * f ( ii ) * n * Ts ) . ' ;
25 end
26
27 %% Compare g with IFFT - print the two vectors to MATLAB prompt
28 g
29 ifft ( data ) * N % undo scale by N factor
Figure 5: MATLAB script for computing the OFDM complex envelope using Equation 1 and the IFFT.
8
3.2 Simulink Model
We will now construct a Simulink model for an OFDM communication system that utilizes the FFT pro-
cessing techniques. The model will be similar to the one built in Section 2 in that it will transmit BPSK
data symbols using four subcarriers. The simulation will utilize 8-point FFT processing. The OFDM symbol
duration will be T = 4 milliseconds, and therefore the spacing between subcarriers will be 1/T = 250 Hz.
Using the results of Section 3, it can be shown that the subcarrier frequencies are
n fn (Hz)
0 0
1 250
2 500
3 750
4 -1000
5 -750
6 -500
7 -250
9
2. The Bernoulli Binary Generator block generates random binary numbers using a Bernoulli distri-
bution. This block acts as our serial data source in the simulation. Set Sample time to Ts and set
Samples per frame to 4.
The BPSK Baseband Modulation block applies BSPK modulation to the serial message bits.
The Multiport Selector block acts as a serial-to-parallel converter. It separates each frame of 4
BPSK symbols into a separate signal. Set Select to Rows and set Indices to output to {1,2,3,4}.
The Vector Concatenate block is used to create a length 8 vector that will be processed by the
IFFT block. Set the Number of inputs to 8, and use a Constant block to specify a value of zero for
the unused elements of the 8 element vector.
As shown in the figure, the input to the IFFT block is
{ b0 b1 0 0 0 0 b2 b3 }
The practice of including zeros is standard in many OFDM systems and will be further explored in
Section 4.
Verify the BPSK symbols and zeros by adding a Time Scope block and running the simulation. You
will probably find it helpful to use a “stem” style plot. Notice that each collection of 8 values spans
8/2000 = 0.004 seconds.
3. The IFFT block performs the IFFT calculation. The default settings should work well for this model.
Because the input frame size is 8, the block will automatically perform an 8 point IFFT.
Use a Spectrum Analyzer block to verify that the modulator is producing an OFDM waveform.
The spectrum should resemble the one shown in Figure 3.
The BPSK Demodulator Baseband block applies BPSK demodulation, and therefore outputs the
recovered serial message signal.
Use Time Scope blocks to verify the operation of the demodulator. You may also want to add a
Constellation Diagram block to view the received signal constellation. Experiment with the noise
variance of the AWGN block.
10
Question 3.1: Submit the following screen captures which verify that you have properly
constructed the Simulink model:
Use a Spectrum Analyzer to view the output of the OFDM Modulator. Comment on
the spectrum plot, paying particular attention to which subcarriers are present in the
OFDM waveform.
Use a Constellation Diagram block to view the input to the BPSK Demodulator
Baseband block. Set the the noise variance to a small (but non-zero) value such that
symbol errors would be very unlikely in the receiver.
Use a Time Scope block to simultaneously view the original serial message signal and the
recovered message signal.
Question 3.2: Modify the Simulink model so that the OFDM system will transmit 6 BPSK
symbols in each T interval by using two additional subcarriers (6 total). It is up to you to
choose which subcarriers to use, and then make the corresponding changes to the model.
Include a Time Scope plot confirming that the recovered message matches the original
message. Include a Spectrum Analyzer plot showing the output of the OFDM modulator.
Compare this spectrum to the one in Question 3.1.
11
4 Real-World OFDM Waveforms: IEEE 802.11a WiFi
In this section we will explore practical considerations for real-world OFDM systems. In particular, we will
create OFDM waveforms that resemble those used in 802.11a WiFi systems.
The IEEE 802.11a standard [1] provides the physical layer specification for wireless LAN communication in
the 5GHz frequency band. Included in the specification are the characteristics of the OFDM signaling. Key
characteristics include the following:
1. The OFDM signaling uses 64 point FFT/IFFT processing spanning a 20MHz frequency band. There-
fore, subcarriers are spaced by 20MHz/64 = 0.3125MHz.
2. The system uses 48 subcarriers for data transnmission and 4 subcarriers for pilots. Pilot subcarriers
are used to assist coherent detection in the receivers. These 52 subcarriers occupy 16.6MHz of the
20MHz frequency band.
3. The subcarrier at 0Hz in the baseband waveform is not used (i.e., filled with a zero).
4. The remaining 11 subcarriers, located at the edges of the 20MHz frequency band, are not used (i.e.,
filled with zeros). These unused subcarriers are sometimes referred to as guard bands.
5. Subcarriers are modulated using BPSK, QPSK, 16-QAM, or 64-QAM.
6. The FFT/IFFT processing results in a 3.2us data waveform.
7. A cyclic prefix , consisting of the last 0.8us of the data waveform, is prepended to create the OFDM
signal. This prefix is sometimes referred to as a guard interval , as it used to avoid interference from
the previous symbol when operating in multipath environments. The total OFDM symbol interval is
4us.
The Simulink model shown in Figure 7 simulates OFDM waveforms that resembles those used in 802.11a
WiFi systems.
Open a new Simulink model and construct the simulation as follows:
The Bernoulli Binary Generator block acts as the serial data source. Set Sample time to 4e-6/52
and set Samples per frame to 52.
The BPSK Baseband Modulation block applies BPSK modulation.
The OFDM Modulator block applies OFDM modulation. Configure the block as shown in Figure 8.
Review the Mathworks documentation for the block given at
https://www.mathworks.com/help/comm/ref/ofdmmodulatorbaseband.html
Click the “Source code” link to inspect the MATLAB code used to implement the block.
Note that the configuration includes:
– length 64 FFT
– 11 guard bands
– the subcarrier at 0Hz (DC) is not used
– cyclic prefix of length 16
For each length 52 data frame originating from the Bernoulli Binary Generator block, the output
of the OFDM Modulator will be a length 80 data frame. This data frame consists of the length 64
result of the FFT operation (52 BPSK symbols plus 12 zeros) prepended by the length 16 cyclic prefix.
The time duration of the length 80 vector is 4us, which corresponds to a sample rate of 20MHz.
12
Figure 7: Simulink model for simulating IEEE 802.11a OFDM waveforms.
13
Question 4.1: Use a Spectrum Analyzer to view the output of the OFDM Modulator.
Include a screen capture. Annotate the key features of the plot. Include a measurement of the
occupied bandwidth of the OFDM signal.
Question 4.2: Use a Time Scope block to view the output of the OFDM Modulator. Include
a screen capture showing one output data frame (length 80). Annotate the plot by identifying
the cyclic prefix.
Question 4.3: A drawback of OFDM systems is the large peak-to-average power ratio (PAPR)
resulting from using a large number of independently modulated subcarriers. High PAPR can
lead to poor efficiency in the transmit power amplifier, as well as poor signal-to-quantization
noise in ADCs and DACs.
The PAPR of a complex signal x(t) is defined as
max[x(t)x∗ (t)]
PAPR =
E[x(t)x∗ (t)]
PAPRdB = 10 log10 (PAPR)
Note that the denominator term is the square of the RMS value.
For a span of 1000 OFDM symbols (each one consisting of a length 80 vector) generated by the
Simulink model, determine the observed PAPR. Give your answer in dB. Include screen captures
and/or MATLAB code documenting your approach.
Hint: Use a To Workspace block to save 1000 OFDM symbols to the MATLAB workspace,
and then perform the PAPR calculation.
Note: Upon carefully observing the OFDM waveforms in the time-domain, you will notice very
large but sporadic peaks. These large peaks represent worst case PAPRs. Appendix A gives a
MATLAB script that generates a histogram of PAPR values where the PAPR is calculated for
each OFDM symbol, providing insight into the PAPR statistics.
14
A PAPR for OFDM
1 %% pa pr_OFDM_ BPSK . m
2 % Script that computes PAPR for BPSK modulated OFDM (802.11 a )
3 %
4 % Cory J . Prust , Ph . D .
5 % Last Modified : 8/25/2018
6
7 clear all
8 close all
9
10 % simulation parameters
11 Nsym = 1 e4 ; % number of OFDM symbols
12
13 % parameters for the OFDM modulator ( similar to 802.11 a )
14 nfft = 64; % fft size
15 cpLen = 16; % OFDM cyclic prefix length
16 nullIdx = [1:6 33 60:64] ' ; % guard bands and 0 Hz null
17
18 PAPRdB = zeros ( Nsym ,1) ;
19 for ii = 1: Nsym
20 % apply modulation
21 binaryData = randi ([0 1] ,52 ,1) ;
22 bpskData = pskmod ( binaryData ,2) ;
23 ofdmData = ofdmmod ( bpskData , nfft , cpLen , nullIdx ) ;
24
25 % compute PAPR
26 peakValue = max ( ofdmData .* conj ( ofdmData ) ) ;
27 m ea nS qu a re Va lu e = mean ( ofdmData .* conj ( ofdmData ) ) ;
28 PAPRdB ( ii ) = 10* log10 ( peakValue / m ea nS qu a re Va lu e ) ;
29 end
30
31 % histogram PAPR values
32 histogram ( PAPRdB ,[0:0.2:15])
33 title ( ' Histogram plot of PAPR values for 802.11 a type OFDM waveform ( BPSK ) ' ) ;
34 xlabel ( ' PAPR ( dB ) ' )
35 ylabel ( ' counts ' )
15
16
References
[1] IEEE-SA Standards Board. IEEE Std 802.11a-1999(r2003), 2003.
[2] Mathworks. Communications Toolbox. Online Resource. https://www.mathworks.com/products/communications.html.
[3] Mathworks. USRP Support Package from Communications Toolbox. Online Resource.
http://www.mathworks.com/discovery/sdr/usrp.html.
[4] Mathworks. RTL-SDR Support Package from Communications Toolbox. Online Resource.
https://www.mathworks.com/hardware-support/rtl-sdr.html.
[5] Leon W. Couch III. Digital and Analog Communication Systems. 7th edition, 2007.
[6] Simon Haykin. Communication Systems. 4th edition, 2001.
[7] B.P. Lathi and Zhi Ding. Modern Digital and Analog Communication Systems. 5th edition, 2019.
17