You are on page 1of 244

ANALYSIS AND SIMULATION OF WIRELESS OFDM COMMUNICAIONS

A Thesis

Presented to the

Faculty of

San Diego State University

In Partial Fulfillment

of the Requirements for the Degree

Master of Science in Applied Mathematics

with a Concentration in

Mathematical Theory of Communication Systems

by

Steven Charles Hemple

Summer 2012
iii

Copyright 2012
by
Steven Charles Hemple
iv

DEDICATION

Dedicated to my patient and loving wife.


v

A mathematician is a device for turning coffee into theorems.

Paul Erdos
vi

ABSTRACT OF THE THESIS


Analysis and Simulation of Wireless OFDM Communications
by
Steven Charles Hemple
Master of Science in Applied Mathematics with a Concentration in Mathematical Theory of
Communication Systems
San Diego State University, 2012

The increase in the number of wireless devices and the requirement for higher data
rates places an increasing demand on bandwidth. This necessitates the need for
communication systems with increased throughput and capacity. Multiple input multiple
output orthogonal frequency division multiplexing (MIMO-OFDM) is one way to meet this
need. OFDM is used in many wireless communication devices and offers high spectral
efficiency and resilience to multipath channel effects. Though OFDM is sensitive to
synchronization errors, it makes the task of channel equalization simple. MIMO makes use of
multiple antennas to increase throughput without increasing transmitter power or bandwidth.
This thesis presents an introduction to the multipath fading channel and describes an
appropriate channel model. Several modulation schemes are presented that are often used in
conjunction with OFDM . Mathematical definitions and analysis of OFDM are given along
with a discrete implementation common to modern communication systems. Synchronization
errors are described mathematically and simulated, as well as techniques to estimate and
correct those errors at the receiver. Lastly, space time coding, spatial multiplexing, and
beamforming are presented as techniques used in (MIMO).
vii

TABLE OF CONTENTS
PAGE
ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
LIST OF TABLES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
ACKNOWLEDGEMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
CHAPTER
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Objective. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Preview of Chapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 THE CHANNEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1 Propagation Mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Large Scale Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Mid-Scale Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.3 Small Scale Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Electromagnetic Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Impulse Response Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.4 Frequency Domain Channel Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.5 Implementation of Channel Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3 MODULATION TECHNIQUES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1 Amplitude Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1.1 Double Side Band Amplitude Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.1.2 Double Side Band Suppressed Carrier. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.3 Single Side Band . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.4 Hilbert Transform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.2 Pulse Amplitude Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.3 Phase Shift Keying/Quadrature Phase Shift Keying . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.4 Quadrature Amplitude Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4 ORTHOGONAL FREQUENCY DIVISION MULTIPLEXING . . . . . . . . . . . . . . . . . . . . 45
viii
4.1 Single Carrier Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
4.2 Multicarrier System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3 Mathematical Description of OFDM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
4.3.1 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.3.2 Demodulation of AWGN Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.3.3 Demodulation of Delay Dispersive Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.4 Implementing OFDM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5 SYNCHRONIZATION ERRORS AND ESTIMATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.1 Syncronization Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.1 Frequency Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
5.1.2 Sampling Clock Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.1.3 Frame Timing Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.2 Synchronization Error Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.2.1 Preamble Structure of IEEE802.11a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.2.2 OFDM Frame Timing Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.2.3 Frequency Offset Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.2.4 Symbol Timing Estimation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.2.5 Channel Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.2.6 Residual Frequency Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6 MULTIPLE INPUT MULTIPLE OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.1 Space Time Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
6.1.1 Space Time Trellis Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
6.1.2 Space Time Block Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.2 Viterbi Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.2.1 Hard Decision Viterbi Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
6.2.2 Soft Decision Viterbi Decoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6.3 Spatial Division Multiplexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6.4 Beamforming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
6.5 Channel Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
7 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
ix
APPENDICES
A MATLAB CODE FOR CHANNEL MODELING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
B MATLAB CODE FOR MODULATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
C MATLAB CODE FOR OFDM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
D MATLAB CODE FOR SYNCHRONIZATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
E MATLAB CODE FOR PREAMBLE AND SYNCHRONIZATION ER-
ROR ESTIMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
F CORRELATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
G PHASE LOCK LOOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
H MATLAB CODE FOR PLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
x

LIST OF TABLES
PAGE
Table 2.1. Relationship Between Channel Parameters and Model Parameters . . . . . . . . . . . . . . 20
Table 6.1. Alamouti Transmission Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Table 6.2. Encoder Transition and Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Table 6.3. Soft Decision Viterbi Decoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
xi

LIST OF FIGURES
PAGE
Figure 2.1. Free space model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 2.2. Free space path loss model for large and small distances. . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 2.3. Doppler shift as a function of speed and angle relative to the transmit antenna. 7
Figure 2.4. Static reflection from wall and line of sight paths. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 2.5. Same phase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Figure 2.6. 4
difference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Figure 2.7. 2
difference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 2.8. Isotropic antennas with Rx antenna movement.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 2.9. Fixed isotropic antennas with two paths. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 2.10. Fixed transmit antenna and moving receive antenna with two paths. . . . . . . . . . 13
Figure 2.11. Channel transfer function with three paths and W = 1GHz, k =
0 and ak = 1 for k = 1, 2, 3, 4, 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 2.12. Delay power spectrum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 2.13. The frequency domain model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 2.14. Output of noise shaping filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 2.15. Output of Hilbert transform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 2.16. Simulated transfer function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Figure 2.17. Simulated impulse response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 2.18. PDF of 3000 simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 3.1. Time series and frequency spectrum of message and carrier signal. . . . . . . . . . . . . 28
Figure 3.2. Time series and frequency spectrum of modulated signal. . . . . . . . . . . . . . . . . . . . . . . 29
Figure 3.3. Time series and frequency spectrum of DSB-SC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Figure 3.4. Frequency spectrum of Hilbert transform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 3.5. Frequency spectrum of modulated SSB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Figure 3.6. PAM-4 constellation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 3.7. PAM-4 signal with Gray coding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Figure 3.8. Gray coding scheme for BPSK.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Figure 3.9. Gray coding scheme for QPSK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
xii
Figure 3.10. Constellation diagram for 16-QAM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Figure 3.11. Gray coding scheme for 16-QAM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 3.12. Receiver block diagram for M-QAM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 4.1. Single carrier system block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Figure 4.2. Single carrier system showing frequency response, power delay
spectrum and symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Figure 4.3. Multiple carrier system block diagram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Figure 4.4. Multiple carrier system showing frequency response, power delay
spectrum and symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Figure 4.5. Cyclic prefix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Figure 4.6. Real part of IDFT output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Figure 4.7. Imaginary part of IDFT output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Figure 4.8. IFFT as a complex signal generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Figure 4.9. FFT as a complex signal demodulator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Figure 5.1. Synchronization blocks in OFDM receiver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Figure 5.2. Effects of normalized carrier frequency offset = 0.05 and
SNR=20dB for 120 simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Figure 5.3. Effects of normalized carrier frequency offset = 0.05 and
SNR=20dB on the constellation for 120 OFDM Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Figure 5.4. Effects of normalized carrier frequency offset = 0.05 and
SNR=20dB on the spectrum for 120 OFDM Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Figure 5.5. ICI coefficients for = 0.5, 0.1, 0.05, 0.025. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Figure 5.6. Power of ICI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Figure 5.7. Carrier-to-interference power ratio.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Figure 5.8. Time series with 1% sample clock offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Figure 5.9. Magnitude of attenuation and phase of 1% sampling period offset. . . . . . . . . . . . . 70
Figure 5.10. Effects of sample clock offset on spectrum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Figure 5.11. Effects of sample clock offset on constellation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Figure 5.12. ICI power. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Figure 5.13. Signal to ICI power ratio. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Figure 5.14. Effects of symbol timing offset of = 8 for Nf f t = 64. . . . . . . . . . . . . . . . . . . . . . . . 77
Figure 5.15. Effects of symbol timing offset of = 8 for Nf f t = 256. . . . . . . . . . . . . . . . . . . . . . 78
Figure 5.16. Possible locations for frame start position. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
xiii
Figure 5.17. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic
prefix and ideal channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Figure 5.18. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic
prefix and multipath channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Figure 5.19. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic
prefix and multipath channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Figure 5.20. Effects of symbol timing offset of = 8 for Nf f t = 64 with no
cyclic prefix and ideal channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Figure 5.21. Effects of symbol timing offset of = 8 for Nf f t = 256 with no
cyclic prefix and ideal channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Figure 5.22. Power of ICI, ISI, and total interference for Nf f t = 64. . . . . . . . . . . . . . . . . . . . . . . . 86
Figure 5.23. Spectrum of short training symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Figure 5.24. Time series of short training symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Figure 5.25. Spectrum of long training symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Figure 5.26. Time series of long training symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Figure 5.27. Time series of preamble. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Figure 5.28. Delay and correlate algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Figure 5.29. Output of the cross-correlator, the auto-correlator, and the thresh-
old detector. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Figure 5.30. Received signal with 50 samples prepended. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Figure 5.31. Time series of preamble with SNR 7dB and frequency offset 200kHz. . . . . 97
Figure 5.32. Output of the cross-correlator, the auto-correlator, and the thresh-
old detector with SNR 7dB and frequency offset 200kHz. . . . . . . . . . . . . . . . . . . . . . . . . 98
Figure 5.33. Frequency estimation algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Figure 5.34. Estimated phase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Figure 5.35. Time series with and without frequency offset correction. . . . . . . . . . . . . . . . . . . . . . 102
Figure 5.36. Output of phase detector and loop filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Figure 5.37. Accumulated phase and VCO output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Figure 5.38. Constellation with and without frequency offset correction. . . . . . . . . . . . . . . . . . . . 105
Figure 5.39. Cross-correlation of long training symbol. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Figure 5.40. Effects of multipath channel on received constellation. . . . . . . . . . . . . . . . . . . . . . . . . 107
Figure 5.41. Channel estimation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Figure 5.42. Received constellation after channel correction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Figure 5.43. Scrambler used to generate psuedo-binary pilot sequence. . . . . . . . . . . . . . . . . . . . . 110
xiv
Figure 5.44. Residual frequency tracking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Figure 6.1. Rate 1/2 convolutional encoder with constraint length 7. . . . . . . . . . . . . . . . . . . . . . . . 113
Figure 6.2. Four state convolutional encoder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Figure 6.3. State diagram for encoder in Figure 6.2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Figure 6.4. Trellis diagram for convolutional encoder in Figure 6.2. . . . . . . . . . . . . . . . . . . . . . . . . 114
Figure 6.5. Alamouti for two transmit antennas.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Figure 6.6. Alamouti for one receive antenna. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Figure 6.7. Channel for two transmit antennas and one receive antenna. . . . . . . . . . . . . . . . . . . . 116
Figure 6.8. Channel for two transmit antennas and two receive antennas. . . . . . . . . . . . . . . . . . . 118
Figure 6.9. Viterbi decoding algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Figure 6.10. Input/output relationship for 3 bit quantizer.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Figure 6.11. Comparison of hard and soft Viterbi decoding.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Figure 6.12. D-BLAST and V-BLAST layered transmission scheme. . . . . . . . . . . . . . . . . . . . . . . 124
Figure 6.13. Directing coverage area to intended users using beamforming. . . . . . . . . . . . . . . . 126
Figure 6.14. Three isotropic antenna configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Figure 6.15. Signal strength for (a) three antennas, distance 10, and relative
phase delay 10, (b) three antennas, distance 10, and relative phase delay
40, (c) five antennas, distance 2, and relative phase delay 25, and (d) five
antennas, distance 5, and relative phase delay 40. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Figure 6.16. MIMO channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Figure 6.17. Alternate transmission of long preamble. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Figure 6.18. Alternating even and odd frequencies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Figure G.1. Basic phase lock loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Figure G.2. Phase lock loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Figure G.3. Dampened spring mass system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Figure G.4. Undamped system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Figure G.5. Damped system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Figure G.6. Proportional control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Figure G.7. Integral control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Figure G.8. Proportional and integral control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Figure G.9. Input to PLL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Figure G.10. Input and output phases to PLL, loop filter, and phase detector. . . . . . . . . . . . . . . 221
Figure G.11. PLL input and output time series. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
xv

ACKNOWLEDGEMENTS
I would like to thank Professors Stefan Hui, Roxana Smarandache and Fredric J.
Harris.
1

CHAPTER 1
INTRODUCTION
The year 2010 saw global mobile data usage increase by almost threefold [4]. This
increased data usage is from the rise in the number of consumer electronic devices that rely on
wireless standards such as IEEE802.11 (Wi-Fi), IEEE802.16 (WiMAX), and cell phones in
particular multi-function smart phones [27]. The rising number of devices that require high
data rates is placing increasing demands on bandwidth. One of the ways these challenges are
being met is with the use of orthogonal frequency division multiplexing (OFDM). OFDM is
not only spectrally efficient but resilient to the effects of the multipath wireless channel.
Another technique being used is multiple input multiple output (MIMO). MIMO has already
been incorporated into the IEEE802.11n, IEEE802.16e, and 4G cellular wireless standards.
The introduction of MIMO into these standards make possible the increased data throughput
and range required by many devices without increases in transmit power or bandwidth.

1.1 H ISTORY
The first use of a digital wireless electronic communication system was the wireless
telegraph. This was also the first use of multiple antennas which aided in the success of
transatlantic wireless communications. Since that time digital communications has become
the de facto standard in modern communications. Though many standards exist for the
different types of wireless digital communications we are most interested in those concerning
wireless local area networks (WLAN) also referred to as Wi-Fi. These are described by the
IEEE802.11 standard.
The first IEEE802.11 standard was released in 1997 and offered data rates of 1 and 2
Mbits/s [11]. In 1999, amendment a was released and increased the data rates to 54M bits/s
and introduced the use of OFDM as the modulation scheme [12]. The inclusion of OFDM
helped to achieve the higher data rate and also increased coverage area. 2003 saw the release
of the g amendment. This amendment also included OFDM but where 802.11a achieved 54
Mbits/s at the 5GHz the g standard achieves this rate at the lower 2.4GHz [14]. The latest
release, amendment n, also uses OFDM and operates at both 2.4 and 5 GHz but achieves
considerably higher data rates of up to 600 Mbits/s with the inclusion of MIMO [15]. MIMO
allows the use of multiple spatial streams to increase throughput, coverage, and even user
capacity.
2

1.2 O BJECTIVE
The goal for this thesis is to give the reader an introductory look into OFDM. Within
this goal, the three main topics presented are channel modeling, OFDM and synchronization,
and MIMO. It is important to give an accurate representation of the channel since it has the
largest impact on the parameters of any communication system. A mathematical description
of OFDM is given as well as the discrete implementation based on the IEEE802.11 standard.
The reader will become familiar with the synchronization difficulties that arise in
implementing OFDM as well as the estimation and correction of those errors. An introduction
to MIMO is also presented based on the IEEE802.11n standard. The reader is presented with
space time coding, spatial multiplexing, and beamforming.

1.3 P REVIEW OF C HAPTERS


Chapter 2 gives a detailed description of the wireless multipath channel. Three
different models are discussed to highlight the different aspects of the channel. The last model
is accompanied by a MATLAB simulation based on the material presented in [21]. Chapter 3
is a review of the different modulation schemes used in digital communications. Though some
are not used as often in conjunction with OFDM, they are the basis for schemes that are.
Chapter 4 covers OFDM. Mathematical definitions of both continuous and discrete versions
are given along with a comparison to single carrier systems. The discrete implementation of
OFDM given uses the IEEE802.11a/g as a guide. Chapter 5 presents synchronization errors
common to OFDM systems. Mathematical descriptions and simulations of the different errors
are presented and analyzed. The second half of the chapter discusses techniques to estimate
and correct those errors in the receiver. Chapter 6 discusses the advantages and challenges of
MIMO. Three main topics are discussed: space time coding, spatial multiplexing, and
beamforming. The appendices contain some background information that might be useful to
the reader such as correlation and an in depth look into phase lock loops. Also included are
MATLAB scripts used in this thesis.
3

CHAPTER 2
THE CHANNEL
The success of any communication system model resides with the accurate
representation of the channel. This is especially so with the wireless channel. Effects which
are non-existent or negligible in a wired communication system can render a wireless channel
unusable unless measures are taken to counteract them.
Variations in channel statistics, called propagation mechanisms, can be placed into
three categories: small, mid, and large scale effects [10]. These categories are described by
the effect that interact with the system based on the separation distance between the transmit
(Tx) and receive (Rx) antennas relative to the radio frequency (RF) wavelength. Each of these
variations can be modeled precisely with the electromagnetic wave equations but as we will
see later, their complexity make them impractical as useful models.
In this chapter we will look at the electromagnetic wave model as a way to gain insight
into the interferences in a wireless channel. This will lead us into the impulse response model.
In this model the channel is considered to be a linear time invariant filter making simulation
more achievable. Several methods have been proposed as to the technique to generate the
impulse response but we will consider one that is presented in [21].

2.1 P ROPAGATION M ECHANISMS


Here we describe the effects that the channel has on the wireless channel. Two types
of propagation mechanisms are described here: large and small scale. These describe how the
channel affects the propagation of the electromagnetic wave for large and small distances
relative to the wavelength.

2.1.1 Large Scale Effects


Large scale propagation effects are those which occur at large distances, many times
the RF carrier wavelength. Two types of large scale propagation effects are path loss and
shadowing. Path loss is the simplest propagation mechanism to model as it is the decrease in
signal power as a function of distance. Consider the simplest case where the transmitter and
receiver are isotropic antennas and are separated by a distance r in a free space environment
as shown in Figure 2.1.
We assume the antenna radiates isotropically and thus the power is the same along the
sphere with the transmit antenna at the origin. It is easy to see that the power will decrease as
4

Figure 2.1. Free space model.

the reciprocal of the distance squared. The path loss FL can be described, in positive terms, by
 2
4r
FL =

 2
4rf
= , (2.1)
c
where wavelength , frequency f , and the speed of light c are related by = c/f [24]. Free
space path loss is usually expressed in decibels,
 
4rf
FL = 20 log10 . (2.2)
c
This model does have is its limitations however. Note that as r 0 the free space loss
FL which clearly can not happen since this indicates an increase in power, greater than
that transmitted. Figure 2.2 demonstrates this anomaly with f = 900MHz and distance in
meters.
The second large scale propagation model is shadowing. This effect is caused by path
obstructions like buildings, vegetation, etc. Though models exist that use information from
geographical information systems (GIS) databases, they are used mainly for cell tower
placement[16]. Because of the difficulty in accounting for the voluminous causes of
shadowing and the distances involved, we will not consider this effect in our model.
5

Free Space Path Loss Model


Free Space Path Loss as a Function of Distance
as a Function of Distance For Small Distances.
10 100

90
0
80
10
70
20
60
Magnitude [dB]

Magnitude [dB]

30 50

40 40

30
50
20
60
10
70
0

80 10
0 50 100 0 0.02 0.04
Distance [m] Distance [m]

Figure 2.2. Free space path loss model for large and small distances.
6

2.1.2 Mid-Scale Effects


Mid scale effects are variations in the channel for same antenna separation distance
and same local area. This effect can be seen when two sets of antennas are in the same room
with the same distance but with drastically different attenuations in the different paths. These
effects will also be excluded from our model except were they contribute to small scale
effects.

2.1.3 Small Scale Effects


These are the effects that we will devote our attention to and derive models for mostly
because for indoor applications they are the dominant effect. The first small scale effect we
consider is Doppler shift. This is caused by either the transmitter or the receiver antenna
moving but for convenience we assume that the transmit is fixed, without loss of generality.
The movement of the antenna will have an effect on the frequency of the transmitted signal.
We saw previously that wavelength and frequency are related by the speed of light, = f /c,
for stationary antennas. The change in frequency or Doppler shift is dependent on the velocity
of the antenna, v, and the angle between the line of sight and the direction of motion, , [26],
v
f = f cos () . (2.3)
c
Equation 2.3 does not take into account relativistic properties such as time dilation and so the
equality is an approximation. Figure 2.3 shows the Doppler shift as a function of v and .
Note that for || = /2, there is no Doppler shift which is what we would expect if the receive
antenna is moving perpendicular, or transverse, to the transmit antenna.
The second small scale effect is multipath fading. This propagation mechanism is the
result of the constructive and destructive interference from the multiple paths taken between
Tx and Rx antenna. These paths can be the line of sight (LOS) or reflections from structures
or terrain. Figure 2.4 describes the most basic scenario with two paths, the LOS and a perfect
reflection off a wall.
The received signal is a superposition of the multiple paths. For our analysis we will
assume (as is the case for practical systems) that the transmitted signal is a sinusoid. With this
in mind, the delay in each path imposes a difference in phase from the LOS path.
Figures 2.5- 2.7 show the effect the two paths with phase differences (in terms of the
wavelength) have on the received sinusoid.
The first graph shows that when the two paths have the same phase the sinusoids add
constructively. The second shows that, while a 1/4 wavelength difference increases the
amplitude, the phase of the received sinusoid has shifted. Clearly, with a 1/2 wavelength
difference the two sinusoids cancel out and the received sinusoid is collapsed.
7

Doppler Shift as a Function of Speed and Angle Relative to Transmit Antenna

300

200

100
Doppler Shift [Hz]

100

200

300

400
pi
pi/2 100
80
0 60
pi/2 40
pi 20
Angle [Radians] 0
Speed [m/s]

Figure 2.3. Doppler shift as a function of speed and angle relative to the transmit
antenna.
8

Figure 2.4. Static reflection from wall and line of sight paths.

Consider the IEEE 802.11 standard which has carrier frequencies of 2.4GHz or 5GHz
and wavelengths
c 2.99 108 m/s
= = = 0.125meters (2.4)
f 2.4 109 Hz
(2.5)

and
c 2.99 108 m/s
= = = 0.06meters. (2.6)
f 5 109 Hz
Thus, we have a complete cancellation of the received sinusoid if two paths have a phase
difference of 0.0625 meters for a 2.4GHz system or 0.03 meters for a 5GHz system. Unlike
the large scale effects, these occur at ranges well within the parameters for an indoor system,
which is why we will consider multipath fading in our model.

2.2 E LECTROMAGNETIC M ODEL


It should be understood that any signal transmitted in a wireless channel is the
propagation of an electromagnetic wave, and to that end, an electro magnetic model would
seem to be the ideal method to model the channel. As we will see, the complex nature of
indoor multipath fading renders this model impractical to implement in simulation for any
practical system, due to the large number of paths. However, analyzing the channel with this
model can aid in a better understanding of the nature of small scale propagation mechanisms
and to this effect we will consider the development of the electromagnetic model.
Let us start with the simplest of models: two isotropic antennas in a free space
environment as shown in Figure 2.1. The electric field at a point ~d can be expressed as
 r
  (, , f )e2jf t c
~ s
E f, t, d = , (2.7)
r
9

Two Waveforms With Phase Difference Full Wavelength.


1

0.5

0.5

The Received Waveform


2

1.5

0.5

0.5

1.5

Figure 2.5. Same phase.


10

Two Waveforms With Phase Difference 1/4 Wavelength.


1

0.5

0.5

The Received Waveform


2

1.5

0.5

0.5

1.5


Figure 2.6. 4
difference.

where ~d represents the point (r, , ) for distance r and horizontal and vertical angles , and
the term s (, , f ) is the complex function describing the radiation pattern of the
transmitting antenna[7]. The magnitude of s accounts for the antenna loss and the phase
accounts for the change in phase due to the antenna and is dependent not only on horizontal
and vertical angles but frequency as well. From equation 2.7 we can see a phase shift in the
electric field of f r/c and is a result of the delay of r/c from the traveling sinusoid. The r in
the denominator is to be expected as we saw earlier a decrease in power by 1/r2 . We will
define the product of the Tx and Rx antenna patterns as (, , f ). Thus the received
waveform is  r
2jf t
(, , f )e c
yf (t) = . (2.8)
r
Equation 2.7 describes the scenario when both Tx and Rx antennas are fixed. We now
consider the case when the receive antenna is moving and the transmit antenna is fixed as
shown in Figure 2.8.
11

Two Waveforms With Phase Difference 1/2 Wavelength.


1

0.5

0.5

The Received Waveform


2

1.5

0.5

0.5

1.5


Figure 2.7. 2
difference.

The point (r(t), , ) at which we observe the energy in the received waveform is now
a function of time and can be described by
  
v f r0
2j f 1 t
  (, , f )e c c
~
E f, t, d(t) = . (2.9)
r0 + vt
As expected, there is a Doppler shift of f v/c caused by the movement. This
introduces a time variance and means that we can not use the easier linear time invariant
model (LTI) unless some assumptions are made [7].
The next case is where we account for the multipath caused by a reflection from a wall
as seen in Figure 2.9. It was stated earlier that it was difficult to simulate multipath with the
electromagnetic model and for that reason we will only consider two paths: the LOS and one
reflection.
Because both antenna are fixed, the received waveform can be described by
 
2d r
2jf t
(, , f )e2jf (t c )
r
(, , f )e c
yf (t) = , (2.10)
r 2d r
12

Figure 2.8. Isotropic antennas with Rx antenna movement.

Figure 2.9. Fixed isotropic antennas with two paths.


13
where d is the distance from the transmitter to the wall and r is the distance between
transmitter and receiver. The first term is what we saw in equation 2.7 and accounts for the
LOS path while the second term is the reflected path and is negative for that reason1 . The first
term has a phase shift of f r/c, while the second has a phase shift of f r/c. Even with the
antennas fixed, we can see a difference in phase between the paths.
If we now allow the receive antenna to move toward the transmit antenna with
constant velocity as seen in Figure 2.10, we have the received waveform as
   
r0 vt r0 + vt
2jf t 2jf t
(, , f )e c (, , f )e c
yf (t) = (2.11)
r0 vt r0 + vt
where the distance between antennas is (r0 vt) and the distance between Tx and the wall is
r0 .

Figure 2.10. Fixed transmit antenna and moving receive antenna with
two paths.

Because the antenna separation is decreasing, the magnitude of the LOS path is
increasing as 1/(r0 vt). Likewise, the distance of the reflected path is increasing, so the
magnitude is decreasing as 1/(r0 + vt). The sinusoids for the LOS path has frequency
f (1 v/c) and the reflected path has frequency f (1 + v/c). Since the received waveform is
the addition of the two waveforms, the received waveform has frequency f v/c.
These last few models only account for movement along the LOS path for perfect
reflections, and only two paths. If we wish to implement this model to analyze, for example,
an indoor wireless communication system, it would prove very challenging. In the next
section we look at a different way to model the channel and after making a few reasonable
assumptions, we will see a more implementable simulation.

1
A more detailed explanation involving ray tracing can be found in [7] and [26].
14

2.3 I MPULSE R ESPONSE M ODEL


In the impulse response model, we consider the channel as a filter. This means that our
task is to find the impulse response of the channel. We would like to use a linear time
invariant (LTI) filter model, but as we saw previously, there is a time varying aspect. We,
therefore, need a few additional assumptions.
First, we consider the path amplitudes. The electromagnetic model described earlier
can accurately model each path amplitude, but the complexity in solving such equations is not
useful in simulation. Two statistical models presented in [24] are Rician and Rayleigh
probability density function (pdf). The Rician pdf describes path amplitudes when there is a
dominant non-fading path such as LOS. The Rayleigh pdf describes the case when many
paths exist but no LOS. In addition, we will assume that there are a fixed number of paths, that
the time delay between paths are equidistant [16], and that the phases are of a uniform
distribution.
There are some aspects of these assumptions that need further discussion. It is not
difficult to see that the number of paths must be fixed for the purpose of simulation. In a more
robust approach we may consider that the number of paths is random and that there arrival is
in groups with arrival times having a Poisson distribution. The groups themselves can be
modeled with a Rayleigh pdf. This model would have a different instantaneous power delay
profile [16]. Both models still have a generally exponential decaying power delay profile.
The general linear time varying complex filter used to describe the wireless channel
impulse response is
N ( )
X
h(t, ) = k (t) [ k (t)] ejk (t) (2.12)
k=1

where t is the observation time of the impulse, is the application time of the impulse, N ( )
is the number of multipath components, k (t) is the random time varying path amplitude,
k (t) is the arrival time and k (t) is the phase [17]. This model will describe the channel
completely and the received signal is just the convolution of the signal s(t) with h(t, ) and
the addition of noise. We stated earlier that an LTI model was desirable, thus we need the
phase, amplitude, and delay to not be time dependent. To justify this, we note that the symbol
time for 802.11a is 4s on a 2.4GHz RF [12]. This means that the wavelength = 0.125
meters, but the waveform propagates from the antenna at 2.99 108 m/s. Since we are
considering indoor uses only, it is unlikely that the channel parameters will change during
transmission for some length of time.
We can define the LTI complex impulse response for the channel as
N
k ( k ) ejk
X
h( ) = (2.13)
k=1
15
and the received signal is then
Z
y(t) = s(t)h( )d + n(t), (2.14)

where n(t) is the noise in the channel to be discussed later. We can also describe the channel
by its transfer function

Z
H(f ) = h( )e(j2f ) d

Z N
X
= k ( k ) e(jk ) e(j2f ) d
k=1
N
X
= k ej(2f k k ) . (2.15)
k=1

Earlier, we assumed for our simulation that k = (k 1)T where T = 1/W and W is the
bandwidth of the signal.
To illustrate the implementation of the transfer function in simulation, consider the
example where W = 1GHz and there are five paths present. Figure 2.11 shows the transfer
function with k = 0 and k = 1 for k = 1, 2, 3, 4, 5. Even though this example is very
simple, compared to an indoor wireless channel commonly seen and channel parameters were
chosen for ease, fading can still be seen in the channel.
We now turn our attention to the channel parameters , , and and their distributions.
The length of the path the signal travels from transmitter to receiver has a significant impact
on the phase of the received signal. Thus, any change in the position of the receive antenna (or
transmitter antenna) results in a change in the phase. We assumed earlier that the number of
paths was fixed but made no other restrictions. If we also assume a large number of paths, the
distribution of the phases along the paths generally follow a uniform distribution on the
interval [0, 2)2 [17]. This assumption is based on the short wavelengths and small indoor area
that we are considering.
The path amplitude distribution depends on the presence of a LOS path. For this
simulation we will assume that the LOS component is present and therefore use the Rician
model. This model assumes that in addition to the LOS path there are a large number of
independent smaller (in magnitude) paths. It is important to point out that the Rayleigh and
Rician models do not approximate the channel for an individual situation very well. They do
approximate the channel when all physical situations are averaged[7]. The Rician pdf is
2
A more detailed explanation and alternative distributions can be found in [17]
16

Channel Transfer Function for


=1 and =0
k k
20

10

0
Magnitude2 [dB]

10

20

30

40
0.5 0.4 0.3 0.2 0.1 0 0.1 0.2 0.3 0.4 0.5
Normalized Frequency f/fsym [Hz]

Figure 2.11. Channel transfer function with three paths and W = 1GHz, k = 0 and
ak = 1 for k = 1, 2, 3, 4, 5.
17
described by
(r2 +2 )
" #

 
r 20 r
PR (r) = e I0 (2.16)
0 0
where 0 is the power of the scattered rays, 2 is the normalized power of the direct (LOS)
ray, and I0 (x) is the modified Bessel function of the first kind. A very important characteristic
of the channel is the Rician K factor,
2
i,max
K= 2
, (2.17)
0 i,max
which is the ratio of the powers of the dominant path to the scattered paths. This ratio
specifies the depth of the fades. For local areas a large K value has shallow fades because the
dominant paths power has a greater magnitude than the scattered paths and thus is not
affected by the lower magnitude interference.
Before discussing the channel parameter , the specific application of this model must
be established. The channel we are simulating is continuous but the implementation of any
simulation is discrete and therefore imposes restrictions on the delay. This means we must
sample the channel but to do this the channel bandwidth must be known. If we sample at an
interval Ts then we limit the channel bandwidth to 1/2Ts and any excess delay separation
< Ts will not be resolvable.
Mathematically, if we apply a rectangular window to the time varying channel transfer
function we have,

HW (f, t) = H(f, t) W (f ) (2.18)


(2.19)

with

1 1
if |f | 2Ts
W (f ) = , (2.20)
0 1
if |f | > 2Ts

which can also be described by the convolution of the channel impulse response and the sinc
function
 

hW (, t) = h(, t) sinc (2.21)
Ts
 
X
ji (t) i (t)
= i (t)e sinc . (2.22)
i
Ts

If we apply a sampling period Ts to ( 2.22) the result is


 
X
ji (t) n Ts i (t)
hW (t) = i (t)e sinc (2.23)
i
Ts
18
where n Z is the discrete excess delay time index. Thus, we have a contribution of
multiples of Ts and so we let i = nTs .
The single most important parameter is considered to be the root means square delay
spread (RDS). The RDS is the second central moment of the normalized power delay profile
X
( ) = i ( i ). (2.24)
i

The RDS is defined as p


rms = 2 2 (2.25)

where
X 2
m = i i for m = 1, 2. (2.26)
i
P0
The parameter rms is related to the average number of fades per bandwidth and the average
bandwidth of the fades [21].

2.4 F REQUENCY D OMAIN C HANNEL M ODEL


In this section we discuss the implementation of a channel model that is derived in the
frequency domain. This model presented in [21] with code in Appendix A, is particularly
useful for OFDM simulation in small local areas (i.e. indoor applications). We have already
looked at the channel parameters in the time domain but we need to redefine them in the
frequency domain.
The first channel characteristic we will consider is the channel correlation function,

H (f1 , f2 , t1 , t2 ) = E {H (f1 , t1 )H(f2 , t2 )} . (2.27)

If we assume that the channel correlation function is a wide sense stationary (WSS) process,
then H depends only on the difference f2 f1 and t2 t1 and thus

H (f, t) = E {H (f, t)H(f + f, t + t)} (2.28)

and since we are assuming that the channel is time invariant for some time interval,

H (f ) = H (f, 0) . (2.29)

We will base the channel model on the delay power spectrum, with delay spread
maximum max , which is the Fourier transform of the spaced frequency correlation function
with coherence bandwidth f . The coherence time is the time duration where the channel
impulse response is considered not varying or where the channel transfer function shows
significant correlation. The coherence bandwidth is the range of frequencies where the
19
channel is considered flat or where the channel transfer function shows significant correlation.
The usual related correlation value is 0.9 [21].
The delay power spectrum we will use to define the frequency selectivity has four
parameters, 2 is the normalized power of the dominant path, is the normalized power
density of the constant part, 1 is the duration of the constant level part, and is the decay
exponent of the exponentially decaying part. The equation for the delay power spectrum is



0 if < 0


2 ( )

if = 0
h ( ) =


if 0 < 1

e( 1 ) if >


1

Figure 2.12 shows the general case for the desired delay power spectrum with
constant level part and exponentially decaying part.

Figure 2.12. Delay power spectrum.

For most channels, a good approximation of the channel can be obtained by setting
1 = 0, giving an exponentially decaying delay power spectrum. Our model will contain a
dominant LOS path so the mean of the channel transfer function is not zero.
We now need to relate the parameters of the delay power spectrum {2 , , , 1 } to the
channel parameters, namely the normalized received power, P0 , the Rician-K factor, K, and
the RDS, rms . The normalized received power P0 is the sum of the delay power spectrum for
20
all or,
Z m
P0 = lim h ( )d
m 0
Z m Z m
2
= lim ( )d + lim e d
m 0 m 0

= 2 + lim em 1
 
m

= 2 + . (2.30)

The Rician K-factor is the ratio of the dominant path to the scattered path and so

2
K=
P0 2
2
= 2
+ 2
2
= . (2.31)

Table 2.1 lists the parameters of the channel and the model and their relationship.

Table 2.1. Relationship Between Channel Parameters and


Model Parameters
Channel Parameters known Model Parameters known (1 = 0)
K
2 = P0 P0 = 2 +
K +1
2K + 1 2
= K=
rms (K + 1)
P0 2K + 1
= rms =
K +1 (K + 1)

Our model uses an exponentially decaying delay power spectrum and as such has an
infinite domain thus we need a maximum excess delay. Though any max can be used, we will
set the maximum where the attenuation has decreased by 43 dB [21]. The maximum excess
delay is then max = 10/ (for the case when 1 6= 0, max = 1 + 10/).
In terms of the channel parameters we have
1
max = 10

 
K +1
= 10 rms . (2.32)
2K + 1
21

2.5 I MPLEMENTATION OF C HANNEL M ODEL


We now look at the implementation of the frequency domain model to obtain the
channel impulse response. The process, shown in Figure 2.13, starts by generating real
valued noise, passing it through a noise shaping filter, and then using a Hilbert transform (see
Section 3.1.4) to make it causal and thus complex. Lastly, the LOS component is added in.

Figure 2.13. The frequency domain model.

The noise shaping filter needs to have a transfer function, G( ), similar to the delay
power spectrum. In general, the noise shaping filter transfer function is defined by

1 if | | 1
|G( )| = (2.33)
e(| |1 ) if | | >
1

but since we have 1 = 0,


|G( )| = e| | . (2.34)
The noise source has variance 2 and the sampled noise has power spectral density (PSD)

S( ) = 2 f, (2.35)

where f is the sampled interval (note that f must satisfy the sampling theorem with
respect to max ). The PSD at the output of the noise shaping filter is

SG ( ) = 2 f |G( )|. (2.36)

After adding the Hilbert transform, the PSD increases by a factor of four,

SH ( ) = 4 2 f |G( )|
= h ( ). (2.37)
22

Because G( ) is proportional to h ( ) by design, the variance of the noise source is



2 = . (2.38)
4f
To test the validity of this model we will use channel parameters obtained from
measurements in [13]. These parameters are P0 = 62.1dB, K = 1.9dB, rms = 9.0ns, 1 = 0,
and TF Length= 801.
Figures 2.14 and 2.15 show the desired delay power spectrum with the noise shaping
filter before and after the Hilbert transform. Recall that we want to simulate a causal channel.

Delay Power Spectrum


10
Theoretical
Simulated

10
Magnitude [dB]

20

30

40

50

60
400 300 200 100 0 100 200 300 400
Exces Delay [ns]

Figure 2.14. Output of noise shaping filter.

Figures 2.16 and 2.17 show the channel transfer function and impulse response. As
expected, we see some deep fades in the transfer function and the impulse response has an
exponential decay.
23

Causal Noise Shapping Filter


10
Theoretical
Simulated

10
Magnitude [dB]

20

30

40

50

60
0 50 100 150 200 250 300 350 400
Excess Delay [ns]

Figure 2.15. Output of Hilbert transform.


24

Channel Transfer Function


55

60

65

70
|H(f)|2 [dB]

75

80

85

90

95
0 100 200 300 400 500 600 700 800 900 1000
Frequency [MHz]

Figure 2.16. Simulated transfer function.


25

Channel Impulse Response


60

65

70

75

80
|h()|2 [dB]

85

90

95

100

105

110

115
20 0 20 40 60 80 100 120 140 160
Excess Delay [ns]

Figure 2.17. Simulated impulse response.


26
Figure 2.18 shows the distribution of the transfer function amplitudes. We stated
earlier that the distribution should be approximately Rician due to the LOS. This is precisely
what we see.

Normalized PDF of Transfer Function Amplitudes


1200
Simulated PDF
Theoretical Rician PDF

1000

800
PDF (|H(f)|)

600

400

200

0
0 0.5 1 1.5 2 2.5 3
Amplitude |H(f)| x 10
3

Figure 2.18. PDF of 3000 simulations.


27

CHAPTER 3
MODULATION TECHNIQUES

There are two types of modulation in wireless communication, analog and digital.
Analog modulation takes an analog message signal at baseband and moves the signal
spectrum in the frequency domain. Digital modulation maps bits in the data stream to analog
waveforms that can be transmitted [7]. Only analog waveforms can be transmitted. The code
for the simulations and figures presented in htis chapter are found in Appendix B.

3.1 A MPLITUDE M ODULATION


Amplitude modulation (AM) is an analog technique for transmitting a message over a
wired or wireless channel. The signal is contained in the variation, or modulation, of the
signal strength, or amplitude, with respect to the carrier signal amplitude. In this chapter we
cover AM, as it is the basis for many modern digital modulation schemes.

3.1.1 Double Side Band Amplitude Modulation


Suppose we have an analog message m(t) that is to be transmitted using amplitude
modulation (AM). This message signal needs to be placed on the carrier signal so that the
amplitude of the carrier signal is modulated by m(t). Let the carrier signal be the sinusoid
cos (2fc t) where fc is the carrier signal frequency. Then the transmitted signal is
(A + m(t)) cos (2fc t) where A is constant.
If we let m(t) = cos(240t) be the message to transmit via AM and let
c(t) = cos(2200t) be the carrier signal and have constant A = 1. Figure 3.1 shows the time
and frequency spectrum for the message and the carrier.
The modulated signal is then

x(t) = [A + m(t)] c(t)


= [1 + cos(240t)] cos(2200t) (3.1)

with time series and frequency spectrum shown in Figure 3.2


This type of amplitude modulation is called double side band full carrier (DSB-AM)
since the carrier frequency is present in the spectrum as well as both side bands of the
message 1 .

1
Refer to [19] for a detailed explanation of the repeated spectrum of the modulated signal.
28

Message
1

0.5

Amplitude
0

0.5

1
0 0.05 0.1 0.15 0.2 0.25
Time [sec]

Message Spectrum
0.5

0.4
Amplitude

0.3

0.2

0.1

0
100 80 60 40 20 0 20 40 60 80 100
Frequency [Hz]

Carrier Signal
1

0.5
Amplitude

0.5

1
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05
Time [sec]

Carrier Spectrum
0.5

0.4
Amplitude

0.3

0.2

0.1

0
500 400 300 200 100 0 100 200 300 400 500
Frequency [Hz]

Figure 3.1. Time series and frequency spectrum of message


and carrier signal.
29

Double Side Band Full Carrier (DSBAM)


1.5

0.5

Amplitude
0

0.5

1.5
0 0.05 0.1 0.15
Time [sec]

Modulated Signal Spectrum


0.5

0.4
Amplitude

0.3

0.2

0.1

0
100 120 140 160 180 200 220 240 260 280 300
Frequency [Hz]

Figure 3.2. Time series and frequency spectrum of modulated


signal.

3.1.2 Double Side Band Suppressed Carrier


Referring to the previous example we can see that a significant amount of energy is
used to transmit the carrier which does not contain any information. Setting the constant
A = 0 we can suppress the carrier frequency as seen in Figure 3.3. This is called double side
band suppressed carrier (DSB-SC).

3.1.3 Single Side Band


Looking at the spectrum of the message we see that both sidebands have the same
spectral components and transmitting both of them would be inefficient. In single side band
modulation we want to transmit just one of the sidebands.
Let x(t) be a signal and X(j) be its Fourier transform where,

x(t) = Re{x(t)} + jIm{x(t)}. (3.2)

Upon applying the Fourier transform we get,

F{x(t)} = F [Re{x(t)} + jIm{x(t)}]


Z
= [Re{x(t)} + jIm{x(t)}] ejt dt

30

Double Side Band Suppressed Carrier (DSBSC)


1.5

0.5

Amplitude
0

0.5

1.5
0 0.05 0.1 0.15
Time [sec]

Modulated Signal Spectrum


0.5

0.4
Amplitude

0.3

0.2

0.1

0
100 120 140 160 180 200 220 240 260 280 300
Frequency [Hz]

Figure 3.3. Time series and frequency spectrum of DSB-SC.


Z
= [Re{x(t)} + jIm{x(t)}] [cos(t) j sin(t)] dt
Z

= [Re {x(t)} cos(t) + Im {x(t)} sin(t)] dt

Z
j [Re {x(t)} sin(t) Im {x(t)} cos(t)] dt

= Re {X(j)} + jIm {X(j)} . (3.3)

We will assume that x(t) is a real signal so that Equations 3.4 and 3.5 describe the real
and imaginary parts of the Fourier transform.
Z
ReX(j) = x(t) cos(t)dt (3.4)

Z
ImX(j) = x(t) sin(t)dt. (3.5)

From Equation 3.4 we can see that the real part of the Fourier transform of a real signal is an
even function. Further, if x(t) is real and even, then
Z
ReX(j) = x(t) cos(t)dt

Z
=2 x(t) cos(t)dt (3.6)
0
31

ImX(j) = 0. (3.7)

Because the frequency spectrum of the signal is even symmetric, the spectrum can be
completely reconstructed with just the positive (or negative) frequencies. The advantage of
transmitting only the positive (or negative) frequencies is seen in the previous example.
As stated earlier, since the spectrum is even symmetric, the signal can be reconstructed
with the use of only the positive (or negative) frequencies. Transmitting the modulated
positive (or negative) frequencies of the signal reduces the required bandwidth and power
used.
One technique to remove the lower (or upper) half of the bandwidth uses the Hilbert
transform. This technique is usually implemented digitally with a band bass filter. There is
another option called vestigial sideband modulation (VSB) which transmits one complete half
of the spectrum plus a selected bandwidth from the other side. For analysis of SSB we present
the Hilbert transform next.

3.1.4 Hilbert Transform


To isolate one side of the spectrum, we want the Fourier transform to take on the form
shown in Equation 3.8. That is, we want the positive Nyquist interval to be untouched, but the
negative Nyquist interval to be zero.

X (j) for 0 < < /2
s
X (j) = . (3.8)
0 for /2 < 0
s

A signal with this property is called an analytic signal. We assumed that x(t) is a real signal,
thus the amplitude spectrum is even and the phase spectrum is odd [2]. However, an analytic
signal does not have an even symmetric amplitude spectrum. Therefore, an analytic signal, xa ,
must be complex and of the form in Equation 3.9.

xa = Re{x(t)} + jIm{x(t)}. (3.9)

Looking at the Fourier transforms, the following is easily verified,


1h
i
Re {X(j)} = X (j) + X (j) (3.10)
2
1 h i
jIm {X(j)} = X (j) X (j) (3.11)
2
where X(j) is the complex conjugate of X(j). Rearranging Equations 3.10 and 3.11
yeilds

X (j) = 2Re {X(j)} X (j) (3.12)


X (j) = 2jIm {X(j)} + X (j) . (3.13)
32

We are requiring that X (j) = 0 for s /2 < 0 so Equations 3.12 and 3.13 become

2Re {X (j)} for 0 < < /2
s
X (j) = (3.14)
0 for s /2 < 0
and
2jIm {X (j)} for 0 < < s /2
X (j) = (3.15)
0 for s /2 < 0.
From Equation 3.9,
X(j) = Re {X(j)} + jIm {X(j)} (3.16)
and from Equations 3.16, 3.14, and 3.15,

jRe {X (j)} for 0 < < /2
s
X (j) = (3.17)
jRe {X (j)} for s /2 < 0
which can be written as
X(j) = H(j)Re {X(j)} (3.18)
where
j for 0 < < s /2
H (j) = (3.19)
j for s /2 < 0
Another way to see this is to write the Fourier transform of the analytic signal xa (t) as

2X(j) for 0 < < s /2



X(j) = X(j) for = 0 (3.20)


0

for /2 < 0
s

= X(j) 2u(j), (3.21)


where u(j) is the unit step function. We know that the product of the Fourier transform of
two signals is the convolution of the two signals. Hence, after taking the inverse Fourier
transform we have
xa (t) = F 1 [X(j)] F 1 [2u(j)] (3.22)
 
1
= x(t) + j x(t) (3.23)
t
where is convolution. Therefore the Hilbert transform is the convolution of the signal and
j/t. Recall the previous example where x(t) = cos (2f0 t) with f0 = 40Hz. The Hilbert
transform of the signal has the spectrum shown in Figure 3.4.
Using Equation 3.23 and modulating to 200Hz we have the single side band (SSB)
modulation of x(t) as seen in Figure 3.5.
33

Baseband Signal Hilbert Transform of Signal


1 1

0.8
0.8
0.6

0.6 0.4

0.2
Magnitude

Magnitude
0.4
0
0.2
0.2

0 0.4

0.6
0.2
0.8

0.4 1
500 0 500 500 0 500
Frequency[Hz] Frequency[Hz]

Figure 3.4. Frequency spectrum of Hilbert transform.

Single Side Band Modulation


2

1.8

1.6

1.4

1.2

0.8

0.6

0.4

0.2

0
500 400 300 200 100 0 100 200 300 400 500
Frequency[Hz]

Figure 3.5. Frequency spectrum of modulated SSB.


34

3.2 P ULSE A MPLITUDE M ODULATION


Pulse amplitude modulation (PAM) is perhaps one of the easiest modulation
techniques for communications [7]. The incoming binary data stream is separated into blocks
of length b and mapped to one of the M = sb signal constellations. The waveform is a
collection of shifted pulses that contain information in the amplitudes
X
s(t) = sk p(t kT ), (3.24)
k

where the sk are the M -ary signals and p(t) is the pulse shape with period T . Figure 3.6 shows
the constellation of PAM-4 and Figure 3.7 shows the PAM-4 signal using rectangular pulses.

Constellation For Four Level PAM


With Gray Coding

3d/2 d/2 d/2 3d/2


Constellation Distance

Figure 3.6. PAM-4 constellation.

In general, any pulse shape can be used, but for analysis assume that the pulse shapes
form an orthonormal family. That is,
Z
p(t kT )P (t mT )dt = km . (3.25)

35

Baseband PAM Signal


With Rectangular Pulse Period T
2
Signal Amplitude

0 T 2T 3T 4T 5T 6T 7T 8T 9T 10T
Symbol Period

Bandpass PAM Signal With Rectangular Pulse Period T And


Carrier Frequency 4 Cycles Per Period
2
Signal Amplitude

0 T 2T 3T 4T 5T 6T 7T 8T 9T 10T
Symbol Period

Figure 3.7. PAM-4 signal with Gray coding.


36
The energy in the signal is defined in the usual way
Z
(sk p(t kT ))2 dt, (3.26)

and because the pulses p(t kT ) are an orthonormal family, the energy for each symbol is s2k .
2 2
Considering the distances shown in Figure 3.6 the symbol energy would be d 4k where d is the
distance between symbols and k = { 3, 1, 1, 3 . . . }. The expected symbol energy is
then
   2
1 d
12 + 32 + + (M 1)2

Es = (2) (3.27)
M 4
d2
12 + 32 + + (M 1)2

= (3.28)
2M
d2 (M 2 1)
= . (3.29)
12
Demodulation of the received signal, r(t), is straight forward since the pulse shapes
P
form an orthonormal family. To recover the sk , where s(t) = k sk p(t kT ), the following
needs to be evaluated
Z
r(t) = s(t)p(t mT )dt (3.30)

Z X
= sk p(t kT )p(t mT )dt (3.31)
k

= sm (3.32)

The probability of symbol error increases as the distance between the constellation
points decreases, thus a decrease in the expected probability of symbol error will increase the
expected value of the symbol energy. Expected probability of symbol error is
 
M 1 d 1
Pe = erfc (3.33)
M 2 2
where is the standard deviation of the Gaussian noise and erfc() is the complementary error
function.

3.3 P HASE S HIFT K EYING /Q UADRATURE P HASE


S HIFT K EYING
Phase Shift Keying (PSK) is a memoryless digital modulation scheme that carries the
message content in the phase changes, whereas in amplitude modulation the information is
carried in the amplitude.
The signal waveform for each symbol in binary PSK (BPSK) is
r  
2Es 2
sk (t) = cos 2fc t + (k 1) , 0 t Ts , 1 k n, (3.34)
Ts n
37
where fc is the carrier frequency, Es is the symbol energy, Ts is the symbol time, and n is the
number of symbols. Binary PSK is a special case of PSK when n = 2 and it is easily seen that
Es = Eb and Ts = Tb . Using a trigonometric identity,
r  
2Es 2
sk (t) = cos 2fc t + (k 1) (3.35)
Ts n
r   r  
2Es 2 2Es 2
= cos (2fc t) cos (k 1) sin (2fc t) sin (k 1) (3.36)
Ts n Ts n
The symbol waveforms for BPSK are
r r
2Es 2Es
s1 (t) = cos (2fc t) (1) sin (2fc t) (0) (3.37)
Ts Ts
r
2Es
= cos (2fc t) (1) (3.38)
T
r s r
2Es 2Es
s2 (t) = cos (2fc t) (1) sin (2fc t) (0) (3.39)
Ts Ts
r
2Es
= cos (2fc t) (1) (3.40)
Ts
Because Es = Eb , the probability of bit and symbol error for BPSK is
r !
1 Eb
Pe = erfc . (3.41)
2 N0
Likewise, quadrature PSK (QPSK) is the case when n = 4 and because there are four
symbols for two bits: Es = 2Eb , and Ts = 2Tb . The signal waveform for each symbol in
QPSK is
r  
2Es 2k 1
sk (t) = cos 2fc t + , 0 t Ts , 1 k n. (3.42)
Ts n
We have
r   r  
2Es 2k 1 2Es 2k 1
sk (t) = cos (2fc t) cos sin (2fc t) sin . (3.43)
Ts 4 Ts 4
The four symbol waveforms for QPSK are
r r
2 2Es 2 2Es
s1 (t) = cos (2fc t) sin (2fc t) (3.44)
2 Ts 2 Ts
r r
2 2Es 2 2Es
s2 (t) = cos (2fc t) sin (2fc t) (3.45)
2 Ts 2 Ts
r r
2 2Es 2 2Es
s3 (t) = cos (2fc t) + sin (2fc t) (3.46)
2 Ts 2 Ts
r r
2 2Es 2 2Es
s4 (t) = cos (2fc t) + sin (2fc t) , (3.47)
2 Ts 2 Ts
38
where
r
2
1 (t) = cos (2fc t) (3.48)
T
r s
2
2 (t) = sin (2fc t) (3.49)
Ts

are the orthogonal basis functions; 1 (t) is called the in-phase component and 2 (t) the
quadrature component. Because both components are separate signals, the probability of bit
and symbol error for each component is the same as BPSK. The probability of being corect is
the probability of being correct in the first and second coordinates. Thus,

Pe = 1 (1 Pbe )2 (3.50)
= 1 1 + 2Pbe Pbe2 (3.51)
r ! r !
Es 1 Es
= erfc erfc2 (3.52)
2N0 4 2N0
r !
Es
erfc (3.53)
2N0
r !
Eb
= erfc . (3.54)
N0

So, the error rate for BPSK and QPSK are approximately the same. Using the Gray coding
scheme, the symbol error rate can be minimized. A symbol error in this scheme will most
likely only give a one bit error, as seen in Figures 3.8 and 3.9. With this scheme, the
probability of bit error is reduced to
r !
1 Es
Pbe erfc . (3.55)
2 2N0

3.4 Q UADRATURE A MPLITUDE M ODULATION


Quadrature amplitude modulation (QAM) is a very popular modulation technique for
digital communication systems primarily because of its spectral efficiency. M-QAM can be
considered an extension of PAM-M, more specifically the Cartesian product of two PAM-M
sets; but, where PAM used real waveforms, QAM uses complex waveforms [7]. Different
types of M-QAM exist, but we will limit our discussion to the rectangular case only. Let u(t)
be the complex baseband waveform. Then the passband waveform is

x(t) = u(t)ej2fc t + u (t)ej2fc t (3.56)


39

Signal Constellation for BPSK


With Gray Encoding

Figure 3.8. Gray coding scheme for BPSK.


40

Signal Constellation for QPSK


With Gray Encoding

Figure 3.9. Gray coding scheme for QPSK.


41
with the more commonly used equation

x(t) = 2Re {u(t)} cos (2fc t) 2Im {u(t)} sin (2fc t) . (3.57)

The constellation diagram for 16-QAM is shown in Figure 3.10 with the minimum
two-dimensional distance between points d.

Constellation Diagram For Rectangular 16QAM

3/2d

d/2
Quadrature

d/2

3/2d

3/2d d/2 0 d/2 3/2d


InPhase

Figure 3.10. Constellation diagram for 16-QAM.

The average energy per symbol Es is twice the energy per symbol for PAM
d2 (M 2 1)
Es = 2 (3.58)
12
42

d2 (M 2 1)
= . (3.59)
6
The probability of bit error for M-QAM depends on the constellation diagram. Here
we see the bit-error probability for rectangular M-QAM, where M = 2k and k is even, in a
Gaussian channel using a matched filter at the receiving end
1 u !
v
2(1 ( M ) ) t 3 log2 M 2Eb
u
Pb Q (3.60)
log2 ( M ) M 1 N0

where Q[x] is the complimentary error function and Eb is the average bit energy[24].
The mapping of the bit blocks to the M-QAM symbols can have an effect on the
bit-error rate. To minimize the bit-errors when a symbol error is present, Gray coding is
employed. Gray coding is a means by which neighboring symbols differ by only one bit, as
seen in Figure 3.11 for 16-QAM. Demodulation of M-QAM is the reverse of the transmitter.
The incoming signal is multiplied by cos(2fc t) on one path and by sin(2fc t) on the other
path as seen in Figure 3.12.
For the received signal r(t) the demodulated signal on the top path is

r(t) = x(t) cos (2fc t) (3.61)


= 2Re {u(t)} cos (2fc t) cos (2fc t) 2Im {u(t)} sin (2fc t) cos (2fc t) (3.62)
= Re {u(t)} [1 + cos (4fc t)] Im {u(t)} sin (4fc t) (3.63)
= Re {u(t)} + [Re {u(t)} cos (4fc t) Im {u(t)} sin (4fc t)] (3.64)

and for the bottom path

r(t) = x(t) sin (2fc t) (3.65)


= 2Re {u(t)} sin (2fc t) cos (2fc t) + 2Im {u(t)} sin (2fc t) sin (2fc t) (3.66)
= Re {u(t)} sin (4fc t) Im {u(t)} [1 cos (4fc t)] (3.67)
= Im {u(t)} [Re {u(t)} sin (4fc t) + Im {u(t)} cos (4fc t)] . (3.68)

The last term in equations 3.64 and 3.68 have frequency 4fc , which is higher than the
baseband signal u(t). After applying a low pass filter, the remaining signals are Re {u(t)} and
Im {u(t)}.
43

Gray Coding For Rectangular 16QAM


4

1
Quadrature

4
4 3 2 1 0 1 2 3 4
InPhase

Figure 3.11. Gray coding scheme for 16-QAM.


44

Figure 3.12. Receiver block diagram for M-QAM.


45

CHAPTER 4
ORTHOGONAL FREQUENCY DIVISION
MULTIPLEXING
Orthogonal frequency division multiplexing (OFDM) is the vehicle that drives modern
digital communications. Its high spectral efficiency and resilience toward multipath distortion
has made possible the increased data rates required in many devices. It is used in many
systems including DSL, IEEE802.11a,g,n (Wi-Fi), digital radio, digital TV, IEEE802.16
(WiMAX), and 3g, 4g, and LTE cell services. OFDM was described by Robert Chang in [3] in
1966 but it wasnt until Weinstein and Ebert [28] presented a practical approach in 1971 that
OFDM was seen as a viable option. What put OFDM into commercial use was the FFT chip.
Before the digital implementation of OFDM via the FFT, communication systems required
banks of signal generators to produce the orthogonal channels. While the analog approach to
OFDM is insightful in analysis, it is expensive and impractical in commercial products.
In this chapter we will first look at the conventional single carrier system to have a
basis of comparison for the multicarrier system. We then look at a mathematical description
of OFDM before considering the implementation of OFDM. While this chapter tries to
generalize the concepts of OFDM, it is helpful to have a standard for simulation and practical
applications. To this end, the IEEE802.11 standard will be a guide in the implementation of a
communication system using OFDM. MATLAB code for the simulation and figures is
presented in Appendix C.

4.1 S INGLE C ARRIER S YSTEMS


The defining characteristic in a single carrier system is the use of the entire available
bandwidth to transmit one data stream. Figure 4.1 shows a typical block diagram for a single
carrier system where data symbols are shaped by a pulse, modulated to RF and passed
through an analog filter. The transmitter uses a matched filter, an equalizer to remove
frequency selectivity and demodulator to arrive at an estimate of the data symbols.
With this type of system, the transmitter benefits in terms of simplicity, but at the cost
of receiver complexity and limited performance. One of the biggest limiting factors is the
multipath channel that was seen in Chapter 2, which causes frequency selectivity. To correct
this problem, equalizers are used. However, as data rates increase so does the complexity of
the adaptive algorithms they use. We also saw the associated delay spread in the multipath
channel which can cause intersymbol interference (ISI) if the symbol time, Ts , is not greater
46

Figure 4.1. Single carrier system block diagram.

than the maximum delay, max . Figure 4.2 shows how the frequency selectivity and the power
delay spread can affect the transmitted symbol. Note the deep fades in the channel frequency
response. These portions of the signal will be lost and hence, the symbol, unless the equalizer
can remove the effects.

4.2 M ULTICARRIER S YSTEM


The multicarrier system divides the available bandwidth into subchannels, each with
its own data stream, and then multiplexes them before transmission. Each subchannel can be
reserved for distinct data streams or one data stream can be divided into N -data streams for
N -subchannels. Figure 4.3 shows a block diagram for a multicarrier system where the block
labeled Data Symbols can be individual data streams or a serial to parallel converter for one
data stream.
One advantage is that a system with a high data rate requirement can be divided into
N lower rate subchannels. These lower rates help combat ISI since the symbol duration is
longer and with an added guard interval, ISI can virtually be eliminated. Figure 4.4 shows that
if the subchannels are narrow enough, the channel frequency response is approximately
constant with respect to each subchannel. This makes equalization much less complicated
than in the single carrier system.
While the subchannels can be chosen in any manner with respect to bandwidth, center
frequency, and guard interval, we next consider a special case in which subchannel parameters
allow for increased bandwidth efficiency (near Nyquist efficiency) and computationally
efficient modulator and demodulator design.

4.3 M ATHEMATICAL D ESCRIPTION OF OFDM


In this section we consider the derivation of orthogonal frequency division
multiplexing. We begin by looking at the mathematical description of OFDM modulation and
then OFDM demodulation. For demodulation, we we consider three different types of
channels: ideal, AWGN, and delay dispersive with AWGN.
47

Figure 4.2. Single carrier system showing frequency response, power delay spectrum
and symbols.

Figure 4.3. Multiple carrier system block diagram.


48

Figure 4.4. Multiple carrier system showing frequency response, power delay spectrum
and symbols.
49

4.3.1 Modulation
Let W be the channel bandwidth and N the number of subcarriers. Then the
subchannel bandwidth is f = W/N and the effective symbol time is Ts = 1/f = N/W .
The subcarrier frequencies are fn = nf = n(W/N ) where the subcarrier spacing is
f = W/N , for n = 0, 1, . . . , N 1. For this analysis we will assume that the input bit
stream is from a complex set of points generated by an IQ modulation scheme like M-QAM.
We will define the basic pulse waveform as

1 ej2fn t if 0 t Ts for n = 0, 1, . . . , N 1
Ts
(t) = (4.1)
0 otherwise
which is the normalized rectangular pulse at frequency fn . Note that the inner product has the
property


1 1
Z
hn (t), m (t)i = ej2fn t ej2fm t dt
Ts Ts
1 j2t(fn fm )
Z
= e dt
Ts
R
1 Ts ej2t(0) dt for m = n
= Ts R0T
1 s j2t(fn fm )
e dt for m 6= n
Ts 0

Ts
t1s t 0
for m = n
=
T s

j2Ts (f1n fm ) ej2t(fn fm )


for m 6= n
0

1 (T 0) for m = n
s
= Ts
1
ej2Ts (fn fm ) 1 for m 6= n

j2Ts (fn fm )

1 for m = n
=  N W

1

j2Ts (fn fm )
ej2 W N (nm) 1 for m 6= n

1 for m = n
=
0 for m 6= n

= m,n . (4.2)

Thus, we have that the subchannels are orthogonal for n = 0, 1, , N 1.


50
The OFDM symbol is a linear combination of the subchannel symbols or pulses which
can be considered as a set of orthogonal basis vectors. Thus the OFDM symbol is
N
X 1
sk (t) = Xn,k n (t kTs ) (4.3)
n=0

where k is the k th OFDM symbol, n is the nth subchannel and Xn,k is the k th M-QAM symbol
in the nth subchannel. The transmitted signal is then

X
S(t) = sk (t). (4.4)
k=

Because the channel has an infinite impulse response (IIR), all past symbols will contribute to
the current symbol.

4.3.2 Demodulation of AWGN Channel


If we assume an AWGN channel, the received signal for the k th OFDM symbol is

rk (t) = sk (t) + (t), (4.5)

where (t) is an additive Gaussian random process. To demodulate the nth OFDM symbol,
the received signal is correlated with the matched filter n (t). Because the pulses are
orthonormal, the correlation will be 0 for m 6= n and 1 for m = n. To recover the k th symbol
on the nth subcarrier
Z Ts
Xn,k = rk (t) (t)dt
0
Z Ts
= [sk (t) + (t)] n (t)dt
0
Z Ts N
X 1 Z Ts
= Xm,k m (t)n (t)dt + n (t)(t)dt
0 m=0 0
N
X 1 Z Ts
= Xm,k m (t)n (t)dt + n
m=0 0

= Xn,k + n . (4.6)

4.3.3 Demodulation of Delay Dispersive Channel


In Section 4.3.2 the channel was assumed to be solely AWGN, but as we saw in
Chapter 2, a more realistic model for indoor wireless channels considers the multipath effects.
We will again consider the channel as an LTI filter described by

h(t, ) h( ). (4.7)
51
With this model, the received signal becomes
Z max
rk (t) = h( )sk (t )d + (t). (4.8)
0

The maximum delay, max , is the smallest delay such that the impulse response is zero for any
delay greater than max . That is

max = inf { [0, ]|h(t) = 0 for t > } . (4.9)

This parameter is important as any adjacent symbol transmitted with time interval
< max will interfere with the adjacent symbol. This is referred to as inter symbol
interference (ISI) and makes symbols difficult to resolve. One way to avoid this is to put a
guard interval or empty space between the symbols. The disadvantage in doing this is that the
subcarriers loose their orthogonality and create inter channel interference.
To retain the orthogonality but still maintain a guard interval, a cyclic prefix is used.
This technique takes a portion of the end of the symbol and cyclically shifts it to the front as
seen in equation 4.10 and Figure 4.5.

Real Part of 25% Cyclically Extnded OFDM Symbol Imaginary Part of 25% Cyclically Extended OFDM Symbol

1 1

0 0

1 1

Figure 4.5. Cyclic prefix.


52

1 ej2fn t for Tg t Ts
Ts
n (t) = (4.10)
0 otherwise
The length of Tg is dependent on the channel and is chosen so Tg > max . This makes
sense since the guard interval needs to exceed the delay spread to be effective against ISI. By
doing this, the linear convolution seen in equation 4.8 becomes a circular convolution in time
and hence, a product in frequency. We still define the effective symbol time as Ts = N/W ,
but the symbol time is now Ts = Ts + Tg . The k th OFDM symbol of the received signal is
demodulated as

Z Ts
Xn,k = rk (t)n (t)dt
0
Z Ts  Z Tg 
= h( )sk (t )d + (t) (t)dt
0 0
Z Ts "Z Tg N
X 1
#
= h( ) Xm,k m (t )d (t)dt + n
0 0 m=0
N 1 Ts Z Tg 
1 j2fn (t )
X Z
= Xm,k h( ) e d (t)dt + n
m=0 0 0 Ts
N 1 Ts Z Tg
1 j2fn t
X Z
= Xm,k e (t)dt h( )ej2fn d + n
m=0 0 Ts 0
N
X 1
= Xm,k m,n H(fn ) + n
m=0

= Xn,k H(fn ) + n . (4.11)

Recall that the channel is in terms of delay which is why the convolution is from
0 < < Tg . So, we are able to preserve the orthogonality of the subcarriers despite the delay
dispersive channel because of the cyclic prefix. Thus, equalization has been reduced to a
multiplying by 1/H(fn ), which is just the sample of the channel at the subcarrier frequency.
By considering the complexity involved in equalizing N subchannels in a delay dispersive
channel, the advantage of using OFDM is clear. There is, of course, a disadvantage to adding
a cyclic prefix in terms of power efficiency, but this is negligible when compared to the
reduction in equalizer complexity [21].

4.4 I MPLEMENTING OFDM


Our discussion of OFDM thus far has been centered on the continuous or analog
model. While mathematically this is the best approach for understanding the concepts, it is
53
impractical for implementation from a cost standpoint. The analog components necessary to
modulate the sub-carriers are expensive and using less expensive components can cause a loss
in the orthogonality of the sub-carriers and create ISI. OFDM as a viable modulation scheme
came into commercial use with the advancements made in DSP and, more specifically, the
inexpensive implementation of the discrete Fourier transform (DFT). Some background on
the DFT is needed in order to understand its impact on OFDM.
Recall that the Fourier transform (FT) is a transformation from one complex valued
function to another complex valued function. The complex valued function we are concerned
with is the signal. The practical use of the Fourier transform in communications is to
decompose the signal into complex sinusoids of varying frequency usually for analyzing
properties of the signal. A DSP implementation of the Fourier transform is far less expensive
and more practical. This is called the discrete Fourier transform (DFT) and is defined as
N 1
n
X
X(k) = x(n)ej2k N for k = 0, ..., N 1, (4.12)
n=0

where x(n) is a sequence of complex numbers and the inverse DFT (IDFT) as
N 1
1 X n
x(n) = X(k)ej2k N for n = 0, ..., N 1. (4.13)
N k=0

The DFT is a sampled version of the Fourier transform and makes a DSP based Fourier
transform possible. Recall that in Section 4.3 we defined one OFDM symbol as

N
X 1
sk (t) = Xn,k n (t kTs )
n=0
N 1
1 X
= Xn,k ej2kfn (tkTs )
Ts n=0
N 1
1 X
Xn,k ej2k( N )(tkTs ) .
W
= (4.14)
Ts n=0

The complex exponential in equation 4.14 is the pulse composed of a complex


sinusoid. This is precisely what the IDFT is, but with a sampled, discrete pulse. The IDFT
also has the property that the complex exponentials ej2kn/N form an orthogonal basis
N 1 N 1
n n  n 
X X
ej2k N ej2l N = ej2(kl) N

n=0 n=0

= N k,l . (4.15)
54
Thus, the IDFT can be used to modulate the sub-channels where the sub-channel
frequency is an integer number of cycles as shown in Figure 4.6 and Figure 4.7. The
DFT/IDFT is computed in O(N 2 ) operations when using equations 4.12 and 4.13. The
number of operations can be reduced by using efficient algorithms, the most common of
which being the Cooley-Tukey fast Fourier transform (FFT), which is a rediscovery of an
algorithm by mathematician Carl Frederich Gauss.

Real Part of 64Point IDFT Output For Frequency Bins 08


0 Cycles per Interval 1 Cycles per Interval 2 Cycles per Interval
1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

3 Cycles per Interval 4 Cycles per Interval 5 Cycles per Interval


1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

6 Cycles per Interval 7 Cycles per Interval 8 Cycles per Interval


1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

Figure 4.6. Real part of IDFT output.

Using this algorithm, the number of computations can be reduced to O(N log N ) and
O( N2 log N ) for N a power of 2. Figure 4.8 shows an example of exciting the third frequency
55

Imaginary Part of 64Point IDFT Output For Frequency Bins 08


0 Cycles per Interval 1 Cycles per Interval 2 Cycles per Interval
1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

3 Cycles per Interval 4 Cycles per Interval 5 Cycles per Interval


1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

6 Cycles per Interval 7 Cycles per Interval 8 Cycles per Interval


1 1 1

0 0 0

1 1 1
0 0.5 1 0 0.5 1 0 0.5 1

Figure 4.7. Imaginary part of IDFT output.


56
bin of a 64-point IFFT and the resulting complex sinusoid of three cycles per period with
N = 64 samples.

Figure 4.8. IFFT as a complex signal generator.

The demodulation of the OFDM symbol is then the FFT of the received symbol which
outputs a sequence of complex numbers as seen in Figure 4.9.
We continue with the assumption made in Chapter 2 that the channel is stationary
during the transmission of at least one OFDM symbol. Using the impulse response of the
channel h(t) as in equation 2.13, we can define the received signal as the convolution of the
transmitted signal and the channel
Z max
rk (t) = h( )sk (t )d + (t). (4.16)
0

If we view the channel as discrete, we can write the received signal as


N
X 1

rk (t) = h[n]sk [t n] + [n]. (4.17)


n=0
57

Figure 4.9. FFT as a complex signal demodulator.

We must keep in mind that a cyclic prefix still needs to be added to the OFDM symbol to
avoid ISI. Let sk [n] be the cyclically extended k th OFDM symbol. Then

sk [n] = sk [N Ncp ], . . . sk [N 1], sk [0], . . . sk [N 1] (4.18)

for the nth sub-carrier with N sub-carriers and cyclic prefix length Ncp and the received signal
is
N
X 1

rk (t) = h[n]sk [t n] + [n]. (4.19)


n=0

The cyclic prefix needs to be removed before demodulation, which amounts to simply
selecting the correct samples, namely n = Ncp , . . . , N + Ncp 1. If we let rk [n] be the
OFDM symbol after the cyclic prefix has been removed, then demodulation yields
N 1
n
X
Xk [l] = rk [n]ej2l N
n=0
Ncp 1
N 1
!
n
X X
= h[m]sk [n m] + [n] ej2l N
n=0 m=0
Ncp 1 N 1
n
X X
= h[m] sk [n m]ej2l N + [l]
m=0 n=0
Ncp 1 N 1
nm
j2l m
X X
= h[m]e N sk [n m]ej2l N + [l]
m=0 n=0
Ncp 1
m
X
= h[m]ej2l N Xk [l] + [l]
m=0
58

= H[l]Xk [l] + [l], (4.20)

where H[l] are the samples of the channel transfer function and [l] are samples of the
additive random Gaussian noise introduced by the channel. This is, of course, what we
expect, as the results should be consistent with the continuous case.
59

CHAPTER 5
SYNCHRONIZATION ERRORS AND
ESTIMATIONS
The most challenging aspect of designing a communication system is the estimation
and correction of synchronization errors that occur during transmission. Synchronization of
the system in time and frequency is still the source of much research and yet is one of the
most often overlooked subjects in published papers [8].
This chapter is divided into two sections. The first gives mathematical descriptions of
the synchronization errors present on OFDM systems. The effects of these errors on the
received signals are analyzed and simulations of the errors are presented whose code can be
found in Appendix D and Appendix E.
The second section describes the estimation of the errors at the receiver. Figure 5.1
shows the block diagram of the synchronization process of a typical receiver. Simulations of
the error estimations are presented using the IEEE802.11 standard for the OFDM frame
structure

Figure 5.1. Synchronization blocks in OFDM receiver.


60

5.1 S YNCRONIZATION E RRORS


In this section the effects of frequency and timing offsets will analyzed and simulated.
As stated earlier, OFDM systems are very sensitive to frequency offsets between transmitter
and receiver when modulating to passband and back to baseband. Both ISI and interchannel
interference (ICI) need to be mitigated as much as possible in order for the system to
accurately receive data.
Much of the ISI can be eliminated with the addition of a guard interval or cyclic prefix
as discussed in chapter 4. ICI is affected by the orthogonality of the subcarriers, which can be
caused by Doppler shift or the offset in carrier frequency between the transmitter and receiver.
Not only must frequency offsets be dealt with but also the sample clock and the frame or FFT
window timing. Offsets in timing can cause ISI as well as ICI.
In this section we will consider carrier frequency offset, symbol timing, and frame
start position. We will not consider Doppler shift, as our concern lies in systems that behave
as stationary, i.e. IEEE 802.11.

5.1.1 Frequency Offset


Let fc [Hz] be the carrier frequency offset and the normalized carrier frequency
offset, , be
fc
= , (5.1)
f
where f is the sub-carrier bandwidth (sub-carrier spacing). There is not only the possibility
of carrier frequency offset between transmitter and receiver, but also a phase difference 0 . As
before, let x[k] be the transmitted sample and h[k] the k th tap of the multipath channel
impulse response with NC taps. Then, the received nth estimated symbol is
N 1 Nc 1
!
1 X X nk k
X[n] = h[l]x[k l] ej2 N ej2 N ej0 , (5.2)
N k=0 l=0
nk k
where ej2 N performs the demodulation via the FFT, ej2 N is the normalized carrier
frequency, and ej0 is the common phase rotation. Evaluating X[n] further we have

N 1 Nc 1 N 1
1 XX X kl nk k
X[n] = h[l] X[m]ej2m N ej2 N ej2 N ej0
N k=0 l=0 m=0
N 1 Nc 1 N 1
1 X j2 k X X nm ml
= e N h[l] X[m]ej2k N ej2 N ej0
N k=0 l=0 m=0
N 1 N 1 N c 1
1 X j2 k X j2k nm
X ml
= e N X[m]e N h[l]ej2 N ej0
N k=0 m=0 l=0
61
N 1 N 1
1 X j2 k X nm
= e N X[m]H[m]ej2k N ej0
N k=0 m=0
N 1 N 1
X 1 X j2k (mn+) j0
= X[m]H[m] e N e
m=0
N k=0
N 1 N 1 N 1
1 X j2k j0 1 X X (mn+)
= X[n]H[n] e Ne + X[m]H[m] ej2k N ej0
N k=0 N m=0,m6=n k=0
j2
 
1 1e
= X[n]H[n] ej0
N 1 ej2 N
N 1
1 ej2(mn+) j0
 
1 X
+ X[m]H[m] (mn+)
e
N m=0,m6=n 1 ej2 N
1 ej
 j
ej

e
= X[n]H[n] ej0
N ej N ej N ej N
N 1
ej(mn+) ej(mn+) ej(mn+) j0
 
1 X
+ X[m]H[m] (mn+) (mn+) (mn+)
e
N m=0,m6=n ej N ej N ej N
1
ej(1+ N ) sin()
 
= X[n]H[n] ej0
N sin( N )

N 1 j(mn+)(1+ 1
)
X e N
sin((m n + )) j0
+ X[m]H[m]   e . (5.3)
m=0,m6=n
N sin (mn+)
N

The first summand in equation 5.3 is the desired demodulated symbol on the nth sub-carrier
with attenuation (sin()/sin(/N )) and phase rotations ej(1+1/N ) /N and ej0 . The
second addend is the contribution of the remaining N 1 sub-carriers with attenuation
(sin((m n + ))/sin ((m n + )/N )) and phase rotation ej(mn+)(1+1/N ) /N and
ej0 . This second summand results in ICI. Figure 5.2 shows the effects of a normalized carrier
frequency offset of = 0.05 and SNR=20dB on the constellation for 120 simulations of
transmitting one OFDM frame.
Figure 5.3 shows the effect of = 0.05 and SNR=20dB on the constellation for the
transmission of 120 OFDM symbols and Figure 5.4 shows the effect on the spectrum.
The coefficients for the second summand are called the ICI coefficients and are
described for the k th sub-carrier index as
1
!
ej(k+)(1+ N ) sin((k + ))
ICIN (k) = (5.4)
N sin( (k+) )
N
62

Constellation of 16QAM with Normalized CFO of =0.05


for 120 Simulations of Transmitting One Frame
1.5

0.5

0.5

1.5
1.5 1 0.5 0 0.5 1 1.5

Figure 5.2. Effects of normalized carrier frequency offset = 0.05 and SNR=20dB for
120 simulations.
63

Constellation of 16QAM with Normalized CFO of =0.05


1.5

0.5

0.5

1.5
1.5 1 0.5 0 0.5 1 1.5

Figure 5.3. Effects of normalized carrier frequency offset = 0.05 and SNR=20dB on
the constellation for 120 OFDM Symbols.
64

Spectrum of 16QAM with Normalized CFO =0.05


Real Part
2

1.5

0.5

0.5

1.5

2
40 30 20 10 0 10 20 30 40
Bin

Imaginary Part
2

1.5

0.5

0.5

1.5

2
40 30 20 10 0 10 20 30 40
Bin

Figure 5.4. Effects of normalized carrier frequency offset = 0.05 and SNR=20dB on
the spectrum for 120 OFDM Symbols.
65
and are shown in Figure 5.5 with = 0.5, 0.1, 0.05, 0.025. The power of the ICI is defined[25]
as
N
X 1
|ICIN (k)|2 (5.5)
k=1
and is shown in Figure 5.6 for = 0.05 for equations 5.4 and 5.5. Another helpful description
is the carrier-to-interference power ratio[25] (CIR), which is analogous to SNR, is defined as
|ICIN (0)|2
CIR = PN 1 2
(5.6)
k=1 |ICIN (k)|

and is shown in Figure 5.7.

Interchannel Interference Coefficients

=0.5
0 =0.1
=0.05
=0.025

10

20
Power [dB]

30

40

50

60
0 10 20 30 40 50 60
Subcarrier Index

Figure 5.5. ICI coefficients for = 0.5, 0.1, 0.05, 0.025.

5.1.2 Sampling Clock Offset


At the receiver the incoming signal is sampled with an analog to digital converter
(ADC). The ADC is driven by the receiver clock which, in practice, is not perfectly
66

ICI Power Resulting From Frequency Offset


0

10

15
Power [dB]

20

25

30

35
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Normalized Carrier Frequency Offset

Figure 5.6. Power of ICI.


67

Carrier to Interference Power Ratio (CIR)


100

90

80

70

60
CIR [dB]

50

40

30

20

10

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
Normalized Carrier Frequency Offset

Figure 5.7. Carrier-to-interference power ratio.


68
synchronized with the transmitter clock. Figure 5.8 show the time series with a sample clock
offset of 1%. The derivation of the demodulated symbol with sampling period offset is similar
to that of Section 5.1.1 where frequency offset was considered. To simplify the derivation, we
assume an ideal channel with no other synchronization error present and no cyclic prefix.

Time Series with 1% Sample Clock Offset


0.3
No Offset
Resampled With Offset

0.2

0.1

0
Magnitude

0.1

0.2

0.3

0.4
0 10 20 30 40 50 60 70
Sample

Figure 5.8. Time series with 1% sample clock offset.

Let T and T be the transmitter and receiver sampling periods respectively and

= T T
T
be the sampling period offset. The continuous time transmitted signal is then
Nf f t 1
1 X j2l t
sk (t) = X[l]e Nf f t T (5.7)
Nf f t l=0
T T
and the sampled signal at the output of the ADC with sampling period offset = T
is

r[nT ] = s[nT ]
Nf f t
1 X j2l NnT T
= X[l]e f f t
Nf f t l=0
Nf f t
1 X j2l
n(1+)
= X[l]e Nf f t T . (5.8)
Nf f t l=0
69

Upon applying the baseband demodulation, the mth sub-carrier is


Nf f t
X j2 Nnm
X[m] = s[nT ]e fft (5.9)
n=0

Nf f t Nf f t
1
n(1+)
X X j2l N j2 Nnm
= X[l]e fft e fft

n=0
N f f t
l=0
Nf f t Nf f t
1 XX j2l n j2l n j2 Nnm
= X[l]e Nf f t e Nf f t e fft
Nf f t n=0 l=0
Nf f t Nf f t
1 XX (lm)
j2n N j2l Nn
= X[l]e fft e fft
Nf f t n=0 l=0
Nf f t Nf f t
1 XX (l(1+)m)
j2n N f t
= X[l]e f
Nf f t n=0 l=0
Nf f t Nf f t Nf f t
1 X j2n
(m(1+)m)
1 X X (l(1+)m)
j2n N f t
= X[m]e Nf f t
+ X[l]e f
Nf f t n=0 Nf f t n=0 l=0,l6=m
Nf f t
! !
1 1 ej2m 1 X 1 ej2(l(1+)m)
= X[m] j2 m
+ X[l] (l(1+)m)
Nf f t 1 e Nf f t Nf f t l=0,l6=m j2 N
1e fft
!
1 ejm ejm ejm
= X[m] j m j m
Nf f t e Nf f t e Nf f t e
Nf f t
!
j(l(1+)m) j(l(1+)m) j(l(1+)m
1 X e e e
+ X[l] (l(1+)m) (l(1+)m) (l(1+)m)
Nf f t l=0,l6=m j j j N
e Nf f t
e Nf f t
e fft

1 jm(1+ N 1 ) sin(m)
= X[m]e fft  
Nf f t sin m Nff t
Nf f t  
1 X j(l(1+)m) 1+ N 1
sin((l(1 + ) m)
+ X[l]e fft   . (5.10)
Nf f t l=0,l6=m sin (l(1+)m)
Nf f t

As with frequency offset, we have the desired demodulated sub-carrier X[m] with attenuation
jm(1+ N 1 )
factor sin(m)/ sin (m/Nf f t ) and phase rotation e f f t . The attenuation is

dependent on sub-carrier index, sampling offset, and the number of sub-carriers. This would
suggest that as the sub-carrier index increases, the attenuation decreases and the phase
increases as shown in Figure 5.9.
Figures 5.10 and 5.11 show the effect of sampling clock offset on the constellation and
the spectrum with no offset, with 1% offset but no ICI, and with 1% offset and ICI.
70

Attenuation and Phase Offset From 1% Sampling


th
Offset on kth Subcarrier
Magnitude of Attenuation on k Subcarrier
0

0.5

1
Magnitude [dB]

1.5

2.5

3.5

4
0 10 20 30 40 50 60
Subcarrier Index

th
Phase Offset on k Subcarrier

1.5
Phase [Rad]

0.5

0
0 10 20 30 40 50 60
Subcarrier Index
Figure 5.9. Magnitude of attenuation and phase of 1% sampling period offset.
71

Effects of Sample Clock Offset on Spectrum


No Sample Clock Offset
1.5
1
0.5
0
0.5
1
1.5
0 10 20 30 40 50 60

Sample Clock Offset of 1% With No ICI


1.5
1
0.5
0
0.5
1
1.5
0 10 20 30 40 50 60

Sample Clock Offset of 1% With ICI


3
2
1
0
1
2
3
0 10 20 30 40 50 60
Subcarrier Index

Figure 5.10. Effects of sample clock offset on spectrum.


72

Constellation Diagram For Sampling Clock Offset of 1%


Constellation With No Offset Constellation With Offset No ICI
2 2

1.5 1.5

1 1
Quadrature

Quadrature
0.5 0.5

0 0

0.5 0.5

1 1

1.5 1.5

2 2
2 1 0 1 2 2 1 0 1 2
InPhase InPhase

Constellation With Offset and ICI


2

1.5

1
Quadrature

0.5

0.5

1.5

2
2 1 0 1 2
InPhase

Figure 5.11. Effects of sample clock offset on constellation.


73
By comparison, recall that the attenuation and phase for frequency offset is solely
dependent on the frequency offset. Also present is ICI caused by the interaction of the
remaining Nf f t 1 sub-carriers

Nf f t  
1 X j(l(1+)m) 1+ 1
Nf f t
sin((l(1 + ) m)
ICI [m] = X[l]e   (5.11)
Nf f t l=0,l6=m sin (l(1+)m)
Nf f t

where the ICI caused by the lth index is dependent on the desired sub-carrier index m and the
sampling offset. To find the the power of the ICI, we assume that the X[k] are independently
identically distributed (iid) so that

E[X ] = 0
k
(5.12)
E[X X ] = 2 ,
k r k,r x

where x2 is the expected value of the power in the data symbols. The power of the ICI for the
mth demodulated sub-carrier is then
2
Nf f t
1 X

sin((k(1 + ) m))
E [ICI (m)ICI (m)] = 2 E[X[k]X [k]]
  (5.13)
Nf f t k=0,k6=m sin (k(1+)m))
Nf f t
2
Nf f t
x2 X sin((k(1 + ) m))
=  . (5.14)
Nf2f t

(k(1+)m))
k=0,k6=m sin

N

fft

Figure 5.12 shows the power of the noise due to ICI for both from equation 5.14 and
the simulation resulting in figures 5.10 and 5.11.
The signal to ICI power ratio is given by

|sk (t)|
SIR = (5.15)
E [ICI (m)ICI (m)]

and is seen in Figure 5.13 for the simulation that resulted in figures 5.10 and 5.11.

5.1.3 Frame Timing Offset


The estimation of the OFDM symbol or frame start position determines the alignment
of the FFT window with the non-cyclically extended OFDM symbol. An offset in the FFT
window can then include a neighboring OFDM symbol causing ISI, which can affect the
orthogonality of the sub-carriers producing ICI. Analysis of the effects of frame timing offset
on the constellation and the spectrum will be discussed with and without the use of a cyclic
prefix for QPSK. We proceed first with the latter case.
74

ICI Power
0
Theoretical
Simulated
2

8
Power [dB]

10

12

14

16

18

20
0 10 20 30 40 50 60
Subcarrier Index

Figure 5.12. ICI power.


75

Signal to ICI Power Ratio


40

35

30
Power [dB]

25

20

15
0 10 20 30 40 50 60
Subcarrier Index

Figure 5.13. Signal to ICI power ratio.


76
Assuming no other synchronization errors and an ideal channel, the time series
samples for the mth OFDM symbol are
Nf f t 1
s
1 X j2 kn
xm [n] = Xm [k]e Nf f t (5.16)
Nf f t k=0

for 0 n Nf f t 1 and sub-carriers 0 k Nf f t 1. The received signal with channel


impulse response hm [n] and AWGN zm [n] is
N
X c 1

r[n] = xm [k] hm [n k] + zm [n] (5.17)


k=0

for channel impulse length Nc . The demodulated symbol is then


Nf f t
X j2 Nln
Xm [l] = 1Nf f t (rm [n])e fft (5.18)
n=0
Nf f t N
!
c 1
X X j2 Nln
= 1Nf f t xm [k] hm [n k] e fft (5.19)
n=0 k=0

= Xm [l]Hm [l] + Zm [l] (5.20)

where Zm [l] is the FFT of the additive Gaussian noise. Let the correct frame start time be
= 0. We assume without loss of generality that > 0 so that the frame includes both the
mth and the (m + 1)th OFDM symbol. The selected samples for the FFT window are
ym = rm [1], rm [2], , rm [Nf f t 1] and with the frame timing offset the selected samples
are ym = rm [], rm [ + 1], , rm [Nf f t 1], rm+1 [1], rm+1 [2], , rm+1 [Nf f t 1 + ]. After
a similar derivation, as that presented in section 5.1.2, the demodulated lth symbol of the mth
frame is

Nf f t j2 l
Xm [l] = Xm [l]Hm [l]e Nf f t
Nf f t
Nf f t 1
1 X X k(n+)nl
j2 N
+ Xm [k]Hm [k] e fft
Nf f t k=0,k6=l n=0
Nf f t 1 Nf f t 1
1 X X j2
k(n+)nl
+ Xm+1 [k]Hm+1 [k] e Nf f t
. (5.21)
Nf f t k=Nf f t Nf f t

The first term is the desired demodulated sub-carrier, but with an attenuation factor as well as
a phase rotation. The second term is the ICI component and the third the ISI. Figures 5.14 and
5.15 show the effect of symbol timing offset of = 8 for Nf f t = 64 and Nf f t = 256
respectively.
77

Symbols with Frame Offset with N =64


fft
2

1.5

0.5
Quadrature

0.5

1.5

2
2 1.5 1 0.5 0 0.5 1 1.5 2
InPhase

Figure 5.14. Effects of symbol timing offset of = 8 for Nf f t = 64.


78

Symbols with Frame Offset with Nfft=256


2

1.5

0.5
Quadrature

0.5

1.5

2
2 1.5 1 0.5 0 0.5 1 1.5 2
InPhase

Figure 5.15. Effects of symbol timing offset of = 8 for Nf f t = 256.


79
The previous figures show that as the number of sub-carriers increases the effect of the
frame timing offset on the attenuation factor decreases. This is explained by the term
(Nf f t )/Nf f t in equation 5.21.
Consider the frame start positions as presented in Figure 5.16 where there is the
addition of a cyclic prefix. There are two possible cases for frame start regions. If the start
point is within region A, it is unaffected by the multipath channel and the FFT window is
within the correct OFDM symbol. The addition of the cyclic prefix extends the OFDM
symbol allowing for the offset FFT window to remain within the correct OFDM symbol. If
the start position is within region B, it will either be affected by the multiple paths (an early
start) or extend into the next OFDM symbol causing ISI and ICI.

Figure 5.16. Possible locations for frame start position.

Figure 5.17 shows the case where the start time for the OFDM symbol is within the
cyclic prefix. In comparison with figures 5.14 and 5.15, only a phase rotation is present.
80

Frame Timing Offset =8 With Cyclic Prefix


1.5
No Offset
Offset

0.5
Quadrature

0.5

1.5
1.5 1 0.5 0 0.5 1 1.5
InPhase

Figure 5.17. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic prefix and
ideal channel.
81
Figure 5.18 shows the constellation with multipath channel, cyclic prefix and frame
timing offset = 8. Notice that the ISI and ICI are not present as in Figure 5.14 but the
rotation of the constellation points and channel effects are present. Figure 5.19 shows the
spectrum of Figure 5.18 revealing the effect that the channel has.

Frame Timing Offset =8 With Cyclic Prefix Mutipath channel


2
No Offset
Offset

1.5

0.5
Quadrature

0.5

1.5

2
2 1.5 1 0.5 0 0.5 1 1.5 2
InPhase

Figure 5.18. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic prefix and
multipath channel.
82

Effects of Symbol Timing Offset With Cyclic Prefix and Channel


Real Part of Spectrum
2

1.5

0.5

0.5

1.5

2
40 30 20 10 0 10 20 30 40
Sample

Imaginary Part of Spectrum


2

1.5

0.5

0.5

1.5

2
40 30 20 10 0 10 20 30 40
Sample

Figure 5.19. Effects of symbol timing offset of = 8 for Nf f t = 64 with cyclic prefix and
multipath channel.
83
As before (section 5.1.2) the power in the ICI, ISI, and the combination of the two can
be found by taking the expected value

ICIpower = E[ICI (l)ICI (l)] (5.22)



Nf f t 1
1 X X k(n+)nl
j2 N
= E Xm [k]Hm [k] e fft
Nf f t k=0,k6=l n=0

Nf f t 1
1 X X k(n+)nl
j2 N
Xm [k]Hm [k] e fft (5.23)
Nf f t k=0,k6=l

n=0

(Nf f t )
= x2 (5.24)
Nf f t

ISIpower = E[ISI (l)ISI (l)] (5.25)



Nf f t 1 Nf f t 1
1 X X k(n+)nl
j2 N
= E Xm+1 [k]Hm+1 [k] e fft
Nf f t k=N Nf f t
fft

Nf f t 1 Nf f t 1
1 X X j2 k(n+)nl
Xm+1 [k]Hm+1 [k] e Nf f t (5.26)
Nf f t k=N N
fft fft

x2
= (5.27)
Nf f t

Total interference power = E[(ICI (l) + ISI (l))(ICI (l) + ISI (l)) ] (5.28)
x2 (2Nf f t )
= (5.29)
Nf f t

where as before x2 is the expected power of the received sub-carrier symbols. Figures 5.20
and 5.21 show the effects of ICI, ISI, and the total interference on the constellation for
Nf f t = 64 and Nf f t = 256. Notice that as Nf f t increases, the contribution of ICI and ISI
decreases as expected from the term 1/Nf f t in equation 5.21.
Comparing figures 5.20 and 5.14 where the start position is within region A, the cyclic
prefix, it is clear that the addition of the cyclic prefix has removed the effects of ISI and ICI
resulting in a constellation that is only affected by an attenuation and a rotation as expected
from equaiton 5.21. Figure 5.22 shows the power of the ICI, ISI, and total interference as a
function of for Nf f t = 64.
84

Effects of Frame Offset =8 Nfft=64


Attenuation and Rotation ICI contribution
2 3

1.5
2
1
1
Quadrature

Quadrature
0.5

0 0

0.5
1
1
2
1.5

2 3
2 1 0 1 2 3 2 1 0 1 2 3
InPhase InPhase

ISI Contributon Symbols with Frame Offset


2
1
1.5

1
0.5
Quadrature

Quadrature

0.5

0 0

0.5
0.5
1

1.5
1
2
1 0.5 0 0.5 1 2 1 0 1 2
InPhase InPhase

Figure 5.20. Effects of symbol timing offset of = 8 for Nf f t = 64 with no cyclic prefix
and ideal channel.
85

Effects of Frame Offset =8 Nfft=256


Attenuation and Rotation ICI contribution
2 3

1.5
2
1
1
Quadrature

Quadrature
0.5

0 0

0.5
1
1
2
1.5

2 3
2 1 0 1 2 3 2 1 0 1 2 3
InPhase InPhase

ISI Contributon Symbols with Frame Offset


2
1
1.5

1
0.5
Quadrature

Quadrature

0.5

0 0

0.5
0.5
1

1.5
1
2
1 0.5 0 0.5 1 2 1 0 1 2
InPhase InPhase

Figure 5.21. Effects of symbol timing offset of = 8 for Nf f t = 256 with no cyclic prefix
and ideal channel.
86

Interference Power for Nfft=64


Power in ICI Power in ISI
6 0

8
5
10
Power [dB]

Power [dB]
12
10
14

16
15
18

20 20
0 10 20 30 40 0 10 20 30 40
Offset [] Offset []

Total Interference
0

4
Power [dB]

10

12

14

16
0 5 10 15 20 25 30 35
Offset []

Figure 5.22. Power of ICI, ISI, and total interference for Nf f t = 64.
87

5.2 S YNCHRONIZATION E RROR E STIMATION


Synchronization is separated into two categories, acquisition and tracking. In
acquisition we focus on carrier frequency offset estimation, symbol timing and frame start
position using the preamble structure outlined in IEEE802.11a [12]. Tracking occurs after the
preamble has been sent and relies on information embedded into each OFDM frame to ensure
carrier frequency and sample clock are locked during transmission.

5.2.1 Preamble Structure of IEEE802.11a


Because of the sensitivity that OFDM has to frequency and timing offsets,
measurements must be taken to estimate and correct these offsets at the receiver. To
accomplish this and other signal processing functions, four OFDM symbols are prepended to
the OFDM burst transmission to aid in acquisition. After this preamble is processed, each
successive frame contains four pilot symbols that are used for tracking frequency and timing.
Both the symbols in the preamble and the pilot symbols are known to the receiver.
The first two OFDM frames contain ten short preambles and are used for automatic
gain control, diversity selection, timing acquisition, and coarse frequency acquisition. We will
focus our attention on the acquisition of timing and frequency. Figure 5.23 shows the
spectrum of the short training symbols.
The short training symbols are generated by taking the IFFT of the following sequence
for frequency bins 26 to 26:
r
13
S26,26 = [0, 0, 1 + 1j, 0, 0, 0, 1 1j, 0, 0, 0, 1 + 1j, 0, 0, 0, 1 1j, 0, 0, 0,
6
1 1j, 0, 0, 0, 1 + 1j, 0, 0, 0, 0, 0, 0, 0, 1 1j, 0, 0, 0, 1 1j,
0, 0, 0, 1 + 1j, 0, 0, 0, 1 + 1j, 0, 0, 0, 1 + 1j, 0, 0, 0, 1 + 1j, 0, 0, ] (5.30)

The repetition seen in Figure 5.24 is from the IFFT of the zero packed sequence in
equation 5.30. The zero packing has the effect of decreasing the symbol time by four, or
Nf f t /4, thus yielding the four copies in the time series. Thus, the short training symbols have
2.5 Nf f t symbols. In our application of OFDM, IEEE 802.11a/g, the bandwidth is 20M Hz
and the sample time is 1/20M HZ = 0.05s. If we set Nf f t = 64, as in IEEE802.11a, there
are 16 samples in the short training symbol and so the symbol time is 16 0.05s = 0.8s.
There are ten short training symbols which gives a total time of 8s.
The last two frames of the preamble contain the long training symbols which are used
for channel estimation and fine frequency acquisition. Figure 5.25 shows the spectrum of the
long training symbols.
The long training symbols are generated by taking the IFFT of the sequence

L26,26 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
88

Spectrum of OFDM Short Training Symbol


Real Part
1.5

0.5

0.5

1.5
30 20 10 0 10 20 30
Frequency Bin

Imaginary Part
1.5

0.5

0.5

1.5
30 20 10 0 10 20 30
Frequency Bin

Figure 5.23. Spectrum of short training symbols.


89

Time Series of Short Training Symbols


Real Part

0 1 2 3 4 5 6 7 8
Time [ s]

Imaginary Part

0 1 2 3 4 5 6 7 8
Time [ s]

Figure 5.24. Time series of short training symbols.


90

Spectrum of OFDM Long Training Symbol


Real Part
1.5

0.5

0.5

1.5
30 20 10 0 10 20 30
Frequency Bin

Imaginary Part
1.5

0.5

0.5

1.5
30 20 10 0 10 20 30
Frequency Bin

Figure 5.25. Spectrum of long training symbols.


91

1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]. (5.31)

The lack of copies in the OFDM frames is from the lack of zero packing in equation 5.31 and
so the symbols have length Nf f t and, along with the added cyclic prefix, the total length of the
long training symbols is 2.5 Nf f t . Again, we set Nf f t = 64 so that the long training symbol
is 64 samples long. With a sample time of 1/20M HZ = 0.05s the long training symbol
time is 64 0.05s = 3.2s. There are two long training symbols and a cyclic prefix of
length 32 so the total time for the long training symbols is 2 3.2s + 32 0.05s = 8s.
Figure 5.26 shows the time series for the long training symbols with the cyclic prefix.
Figure 5.27 shows the time series of the complete preamble with 320 samples and
length 16s.

5.2.2 OFDM Frame Timing Estimation


Timing estimation is broken into two parts, frame timing or packet detection and
symbol timing. In both cases we use the preamble for detection. Here we start with frame
timing and exploit the periodicity of the short training symbols using the auto-correlation as
described in [23]. From Appendix F, the cross-correlation function is defined as

f[m]g[m].
X
f g (5.32)
m=

The correlation of the signal with a delayed copy of itself is defined as


N
X
A[n] = r(k + n)r[k + n + L], (5.33)
k=0

where A[n] is the output, r[n] is the received sequence, L is the length of one short symbol
and the length of the delay. There are several algorithms for coarse timing but all use the
correlation properties of the short training symbols. In this analysis, the delay and correlate
algorithm presented in [23] and [9] is used. Figure 5.28 shows the block diagram for this
algorithm.
The top path, P (d), contains the cross-correlator and the bottom path, R(d), contains
the auto-correlator. The value in the bottom path is to avoid division by zero. The
auto-correlator computes the power in the samples and is used to normalize the decision at the
threshold detector. The cross-correlator takes advantage of the periodicity in the short training
92

Time Series of Long Training Symbols


Real Part

0 1 2 3 4 5 6 7 8
Time [ s]

Imaginary Part

0 1 2 3 4 5 6 7 8
Time [ s]

Figure 5.26. Time series of long training symbols.


93

Preamble Sturcture for IEEE 802.11a


Real Part

0 2 4 6 8 10 12 14 16
Time [ s]

Imaginary Part

0 2 4 6 8 10 12 14 16
Time [ s]

Figure 5.27. Time series of preamble.

Figure 5.28. Delay and correlate algorithm.


94
symbols to locate the frame boundaries. These are defined mathematically as
L1
X
P (d) = r(d + m)r(d + m + L) (5.34)
m=0
L1
X
R(d) = |r(d + m + L)|2 , (5.35)
m=0

where L is the length of the register in the moving average and r(d) is the dth sample of the
received signal. M (d) is the output of the correlator normalized by the received power and
then tested against a threshold level. Squaring helps mitigate the effects of large peak to
average power ratios common in OFDM. Figure 5.29 shows the output of the correlator, the
received power and the threshold detector for the received signal in Figure 5.30. The signal
starts after the first 50 samples and because a length of 16 was used for the moving average
filter, the maximum value of the correlation and the power is not reached for 16 samples. Also
note that the timing estimate M (d) reaches a maximum at the 51st sample, which is the
correct timing.
One might wonder why the auto-correlation is used in determining the frame start
since the cross-correlation shows the symbol boundaries. The received signal will have a
carrier frequency offset as well as multipath interference and Gaussian noise. Figure 5.31
shows the effect of a 200kHz frequency offset and 7dB SNR on the time series input to the
delay and correlate algorithm.
Figure 5.32 shows the output of the cross-correlator, auto-correlator, and threshold
detector for a 200kHz frequency offset and 7dB SNR.
In both Figures 5.29 and 5.32, the falling edge of the packet detection can be
determined. Notice, however, that while in an ideal channel, Figure 5.29, the cross-correlation
function can also detect this edge simply by looking at the peak values while in a non-ideal
channel as in Figure 5.32, the peak values have changed and determining the frame timing
becomes difficult. For this reason the auto-correlation function is used to normalize the input
to the threshold detector. Even with poor channel conditions the frame is still detected,
although with a sample error. This sample error will need to be corrected with fine timing, or
symbol timing estimation.

5.2.3 Frequency Offset Estimation


Estimation of frequency offset during the acquisition phase is performed in two parts.
Coarse frequency offset uses the short training symbols and fine frequency offset uses the
long training symbols. Both coarse and fine frequency estimation use the same algorithm,
correlation with the received signal and a delayed copy. The conjugate product is then passed
to a phase detector that outputs the phase error.
95

Frame Timing Estimation With Ideal Channel


Top Path (Correlation With Delyed Copy) Bottom Path (Received Power)
15 15

10 10

5 5

0 0
0 50 100 150 200 250 0 50 100 150 200 250
Sample Sample

Output of Coarse Timing Estimator


1.5

0.5

0
0 50 100 150 200 250
Sample

Figure 5.29. Output of the cross-correlator, the auto-correlator, and the threshold
detector.
96

IEEE 802.11a Preamble Prepended With 50 Samples


Real Part
0.2

0.15

0.1

0.05

0.05

0.1

0.15

0.2
0 50 100 150 200 250 300 350 400

Imaginary Part
0.2

0.15

0.1

0.05

0.05

0.1

0.15

0.2
0 50 100 150 200 250 300 350 400

Figure 5.30. Received signal with 50 samples prepended.


97

IEEE 802.11a Preamble Prepended With 50 Samples


Real Part
0.2

0.15

0.1

0.05

0.05

0.1

0.15

0.2
0 50 100 150 200 250 300 350 400

Imaginary Part
0.2

0.15

0.1

0.05

0.05

0.1

0.15

0.2
0 50 100 150 200 250 300 350 400

Figure 5.31. Time series of preamble with SNR 7dB and frequency offset 200kHz.
98

Frame Timing Estimation With Frequency Offset=200kHz, SNR=7dB


Top Path (Correlation With Delyed Copy) Bottom Path (Received Power)
15 15

10 10

5 5

0 0
0 50 100 150 200 250 0 50 100 150 200 250
Sample Sample

Output of Coarse Timing Estimator


1.5

0.5

0
0 50 100 150 200 250
Sample

Figure 5.32. Output of the cross-correlator, the auto-correlator, and the threshold
detector with SNR 7dB and frequency offset 200kHz.
99
The maximum frequency offset allowed in the IEEE 802.11a standard (section
17.3.9.4) [12] is 20ppm for carrier frequencies between 5.15 5.825GHz. This means that
the maximum frequency offset between transmitter and receiver (for carrier frequency
5.825GHz) is

f = 40 106 5.825 109


 
(5.36)
= 233kHz. (5.37)

Hence any algorithm used to estimate and correct frequency offset needs to operate with this
amount of offset.
Suppose the received signal is

y(t) = x(t)ej2f t , (5.38)

where x(t) is the transmitted signal and f is the frequency offset. As stated previously, the
short training symbols have a length of 16 samples or 0.8s. Then the output of the conjugate
product from the correlation of the signal and the delayed copy is

y(t)y (t t) = |x(t)|2 ej2f (t) . (5.39)

The frequency offset is found by taking the arctangent of both sides

y(t)y (t t) = |x(t)|2 ej2f t) (5.40)


y(t)y (t t) = 2f t (5.41)

y(t)y (t t)
f = (5.42)
2t
where t is the symbol time. The output of the phase detector is based on the arctangent
function and thus has a range of [, ). This means that the maximum detectable frequency
offset using the conjugate product is

f = 1
 (5.43)
2(16) 20GHz

= (5.44)
2(0.8s)
= 625kHz, (5.45)

or about 107ppm at 5.825GHz, much greater than the allowable frequency offset. By
comparison, using the long training symbols, the detectable frequency offset is

f = 1
 (5.46)
2(64) 20GHz

= (5.47)
2(3.2s)
= 156kHz (5.48)
100
or about 13ppm, much less than what is allowed. This is why the short training symbols are
used for the coarse estimation and correction before using the long training symbols for fine
frequency estimation and correction. Figure 5.33 shows the frequency estimation algorithm.

Figure 5.33. Frequency estimation algorithm.

Consider the example where the frequency offset is 200kHz. Figure 5.34 shows the
estimated phase of the received signal using the short training symbols where a 16 sample
delay is seen in the output. The poor phase estimation in the long training symbol portion is
because the algorithm uses a delay length of 16 where the long training symbols have a length
of 64. Figure 5.34 also shows the phase estimation using the long training symbols where a
delay of 64 samples occurs. The effects of frequency offset and correction on the time series
is shown in Figure 5.35
The previous example did not incorporate a phase locked loop (PLL) but instead the
phase estimation of the entire preamble was computed and the average of the phase error was
applied to the entire series. This is an impractical implementation because of the delay in
waiting for the entire preamble to arrive. We now consider an example which uses a PLL with

the same 200kHz frequency offset. By trial and error the values n = 2/49 and = 2/2
were found making ki = 0.0594 and kp = 0.1638. The output of the phase detector and the
output of the loop filter are shown in Figure 5.36.
The accumulated phase of the variable controlled oscillator (VCO) and the VCO
output are shown in Figure 5.37. Notice that the frequency is correctly estimated but there is a
phase offset in the VCO output. This is referred to as residual frequency offset and is dealt
with using the pilot symbols.
Lastly, the constellation of the received signal with and without frequency offset
compensation is seen in Figure 5.38. The phase offset seen in the VCO output is also seen in
the corrected constellation.
101

Frequency Estimation and Correction


Phase Estimation of Received Signal
0.5

0.5
0 50 100 150 200 250 300 350
Phase Estimation After Course Frequency Correction With Short Training Symbols
0.5

0.5
0 50 100 150 200 250 300 350

x 10
16 Phase Estimation of Long Training Symbols After Coarse Frequency Corretion
0

6
180 200 220 240 260 280 300 320

x 10
16 Phase Estimation After Fine Frequency Corretion With Long training Symbols
0

6
180 200 220 240 260 280 300 320

Figure 5.34. Estimated phase.


102

Time Series of Received Signal With Frequency Correction


Transmitted Signal
0.2

0.2
0 50 100 150 200 250 300 350
Recieved Signal With Frequency Offset of 200[KHz]
0.2

0.2
0 50 100 150 200 250 300 350
Received Signal After Course Frequency Correction
0.2

0.2
0 50 100 150 200 250 300 350
Received Signal After Fine Frequency Correction
0.2

0.2
0 50 100 150 200 250 300 350

Figure 5.35. Time series with and without frequency offset correction.
103

Input and Output to Loop Filter


Phase Error
0.01

0.008

0.006

0.004

0.002

0
0 20 40 60 80 100 120 140 160

Loop Filter Output


0.07

0.06

0.05

0.04

0.03

0.02

0.01

0
0 20 40 60 80 100 120 140 160

Figure 5.36. Output of phase detector and loop filter.


104

Accumulated Phase VCO


10

8
Radians

0
0 100 200 300 400 500 600 700 800 900 1000

Real Part of Input and Output Phase


2
Input Phase
Output Phase
1

1
0 100 200 300 400 500 600 700 800 900 1000

Imaginary Part of Input and Output Phase


2
Input Phase
Output Phase
1

1
0 100 200 300 400 500 600 700 800 900 1000

Figure 5.37. Accumulated phase and VCO output.


105

Figure 5.38. Constellation with and without frequency offset correction.

5.2.4 Symbol Timing Estimation


Symbol timing or fine timing is performed after coarse timing and after frequency
offset correction. Fine timing estimation uses the cross-correlation of the known long training
symbol with the received long training symbol to determine the start and end of an OFDM
symbol and consequently the start and end of the FFT window. As discussed in section 5.2.2,
the cross correlation is sensitive to frequency offset and this explains the importance of
correcting frequency offset before performing symbol timing estimation [16].
During the frame timing estimation, the starting edge of the packet was determined but
within the packet symbol timing errors can be present. The cross-correlation of the known
long training symbol and the received long training symbol can be determined by
M
X

r(n) = rLT S (m)rLT S (m n), (5.49)
m=0

where rLT S is the received long training symbols, rLT S is the known long training symbol,
and M is the length of the long training symbol. In Appendix F, it is shown that there is a
relationship between the cross-correlation operator and the convolution operator. It is
desirable to use the convolution operation since it can be performed using the FFT, which
reduces the number of computations [19]. Hence, we have the symbol timing estimation as

r(n) = rLT S (n) rLT S (n), (5.50)

where is the convolution operator.


106
There are two and a half long training symbols (the half symbol provided by the cyclic
prefix) in the IEEE802.11a standard. Thus the cross-correlation should have three peaks, the
first being about half the magnitude of the other two, which can be seen in Figure 5.39.

Fine Timing Estimation


IEEE 802.11a Preamble

16 32 48 64 80 96 112 128 144 160 192 256 320


Sample

CrossCorrelation of Known LTS and Received LTS

0.5

16 32 48 64 80 96 112 128 144 160 192 256 320

Figure 5.39. Cross-correlation of long training symbol.

The first peak corresponds to the end of the cyclic prefix and the other two peaks
correspond to the ends of the two long training symbols which have the same length as the
OFDM symbol.
107

5.2.5 Channel Estimation


In Chapter 2, the effects of a multipath channel, namely frequency selectivity, were
discussed. Thus far only frequency and timing offsets have been estimated and corrected. The
effect of a multipath channel on the received constellation diagram is seen in Figure 5.40.

Received Signal With Channel Distortion


1.5

0.5
Quadrature

0.5

1.5
1.5 1 0.5 0 0.5 1 1.5
InPhase

Figure 5.40. Effects of multipath channel on received constellation.

To counter these effects, an equalizer is used. In a conventional single carrier system


equalization takes place in the time domain where the equalizer can be computationally
intensive.
In an OFDM system, the equalization takes place in the frequency domain with the
advantage that if the sub-channels are sufficiently narrow bands, the frequency fading of the
channel can be considered flat within each sub-channel [9].
108
Let Y be the received signal, X the transmitted signal, and H the channel frequency
response. Then
Y [k] = H[k]X[k] + Z[k], (5.51)

where Z is the noise. Here we take advantage of the property of Fourier transforms, that
convolution in the time domain corresponds to the product in the frequency domain. As stated
in Chapter 2, it is assumed that the channel is stationary during each transmitted packet. We
have then, setting Z[k] = 0,
Y [k]
H[k] = . (5.52)
X[k]
In this way, the channel can be estimated but only if the transmitted signal is known. To this
end, the long training symbols are used. Recall that the long training symbols use all
sub-carriers (except DC) so that all used sub-carrier equalizer gains are found. Equation 5.52
describes the channel frequency response for each sub-carrier but the inverse is needed to
counter its effects:

|H[k]|2 = H[k]H[k] (5.53)


H[k]
H 1 [k] = . (5.54)
|H[k]|2

It is common to average the equalizer gains over the two long training symbols to help
mitigate the effects of the noise. Figure 5.41 shows the channel frequency response and the
channel estimation using the above method. Notice that the noise in the channel affects the
estimation. Figure 5.42 shows the received constellation after the channel estimation has been
applied to Figure 5.40.

5.2.6 Residual Frequency Offset


In Section 5.1.1, carrier frequency offset was simulated and in Section 5.2.3, a method
of estimation and correction was put forward. The simulation showed very precise estimation
that left the system with negligible errors. In real implementations of frequency offset
estimation, the frequency offset is not constant (as simulated in section 5.1.1) and the system
itself introduces thermal noise and phase degredation, which increases the error in carrier
frequency offset [5]. This error is a residual frequency offset and while it may be small the
accumulation of the offset can destroy the orthogonality of the sub-carriers.
To continue tracking the frequency offset, each OFDM symbol contains four pilot
subcarriers at frequency bins -21, 7, 7, 21 and are BPSK modulated using a pseudo-binary
sequence [12]. The psuedo-binary sequence prevents spectral lines and can be generated by
the data scrambler in Figure 5.43 [12].
109

Multipath Channel with SNR=43.3486


0
Channel Estimation
Channel Frequency Response

10

20
|H[f]|2 [dB]

30

40

50

60
30 20 10 0 10 20 30
Frequency bin

Figure 5.41. Channel estimation.


110

Received Signal With Channel Correction


1.5

0.5
Quadrature

0.5

1.5
1.5 1 0.5 0 0.5 1 1.5
InPhase

Figure 5.42. Received constellation after channel correction.

Figure 5.43. Scrambler used to generate psuedo-binary pilot sequence.


111
The scrambler is initiated with all ones and produces the cyclically extended 127
element sequence P0 in equation 5.55:

P0..126v = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} (5.55)

The algorithm for tracking frequency is similar to that of course frequency estimation.
After baseband demodulation, the pilots are extracted and the phases of the pilots are
compared to the phases of the previous pilots. The phase offset is sent to a loop filter, then to a
VCO, and multiplied to the input of the FFT. Appendix G further discusses the phase lock
loop and Appendix H contains MATLAB code to simulate the PLL. Figure 5.44 shows one
possible residual phase tracking configuration.

Figure 5.44. Residual frequency tracking.


112

CHAPTER 6
MULTIPLE INPUT MULTIPLE OUTPUT
One of the first uses of multiple antennas was in 1901 when Guglielmo Marconi used
multiple transmit antennas to transmit the Morse symbol S (three short dots) from Poldhu,
Cornwall, England, to Signal Hill in St. Johns Newfoundland, a distance of 2,200 miles. The
multiple antennas transmitted the same signal in a scheme called spacial diversity. In the
1940s, submarines began experimenting with active sonar. Multiple sound transmitters were
used with delays added, allowing certain areas to be covered. This is called beamforming and
is a type of space-time diversity.
Though multiple antennas have been used for some time, standards such as
IEE802.11n (Wi-Fi) and IEEE802.16 (WiMAX) have brought the technology to consumer
products. The technology has made possible the increased throughput required for many
applications and takes advantage of the ubiquitous wireless multipath channel. Multiple input
multiple output (MIMO)1 not only increases quality of service but can achieve data rates near
channel capacity, and thus using the bandwidth more efficiently. The increase in quality of
service means an increase in the coverage area via increased SNR.
In this chapter, we will explore MIMO using the IEEE802.11n standard for illustrating
the implementation in a realizable system. The three areas of interest that will be discussed
include space-time coding (STC), spatial division multiplexing (SDM), and transmit
beamforming.

6.1 S PACE T IME C ODING


Space time coding (STC) algorithms are used to increase the reliability of the
reception of data by transmitting multiple copies of the data stream. This redundancy aids in
combating the fading present in wireless channels. This is because there is an increase in
probability that if one transmission experiences poor channel conditions which result in
errors, that the other transmission(s) are recoverable. It is reasonable to assume that channel
conditions for each path are not the same for each spatial stream[21].
Space time codes be categorized as either space time trellis codes (STTC) or space
time block codes (STBC). STTCs use redundancy to achieve coding and diversity gains 2
operating on one input symbol at a time and outputting a vector whose length is the number of
1
The input output in MIMO does not refer to the transceiver but to the number of spatial streams input and
output to the channel
2
The increase in the SNR is due to the diversity scheme, in this case the number of transmit antennas
113
transmit antennas. STBCs, by contrast, operate on blocks of input symbols and output a
matrix where the number of rows is the number of transmit antennas and the columns
represent time. STBCs also offer full diversity but with much less encoder decoder
complexity [22].

6.1.1 Space Time Trellis Codes


The IEEE802.11 standard allows for the use of the STTC convolutional codes as a
means of forward error correcting codes[12]. Though the IEEE802.11n standard also allows
for low density parity check codes (LDPC) and turbo codes, we will focus on the widely used
convolutional codes as presented in IEEE802.11a.
Convolutional codes are characterized by the following three parameters: the number
of output bits, n, the number of input bits, k, and the constraint length, L. The rate of the code
is the ratio of input bits to output bits, k/n. Convolutional codes also have associated
generating polynomials, the number of which depends on the number of output bits, usually
written in octal notation. The convolutional code shown in Figure 6.1 is a (2,1,7) code with
rate 1/2 and generating polynomials g0 = 1338 and g1 = 1718 , which is the industry standard
[15]. The generating polynomials, in the more insightful binary notion, are g0 = 10110112
and g1 = 11110012 and describe the XORing of the current and shifted values in the registers.

Figure 6.1. Rate 1/2 convolutional encoder with constraint length 7.

The convolutional coder is a finite state machine with assumed initial null state and as
such, has two diagrams to show the state transitions. The four state convolutional encoder
114
shown in Figure 6.2 is described by the state diagram shown in Figure 6.3 and the trellis
diagram as seen in Figure 6.4. Unlike the state diagram, the trellis diagram adds a time
component showing the output and states for a given input; a red line represents an input of
one and a black line an input of zero. Each path of the trellis diagram corresponds to an
encoded sequence.

Figure 6.2. Four state convolutional encoder.

Figure 6.3. State diagram for encoder


in Figure 6.2.

Figure 6.4. Trellis diagram for convolutional encoder in Figure 6.2.

Both the state and trellis diagrams show two branches to and from each state and it can
be shown that for a convolutional encoder with m memory elements there are 2m branches at
each of the 2m states. Also note that not all state transitions are possible, hence only certain
paths can exist. It is this feature that will be exploited to decode the received bit stream.
115

6.1.2 Space Time Block Codes


Space time block codes differ from STTCs in that they operate on a block of data
instead of one piece of data during each time interval. In 1998 Siavash Alamouti proposed a
two antenna STBC that does not require any bandwidth expansion or channel state
information (CSI) at the transmitter [1]. His two antenna scheme was generalized to
incorporate more antennas and thus increasing the block size operated on, however, the two
antenna transmit scheme is a rate 1 code and it has been shown that this is the only
configuration to achieve this rate. Here we look at the case presented in [1] for two transmit
antennas.
The Alamouti coded OFDM system is shown in Figures 6.5 and 6.6. As before, we
consider the Rayleigh multipath fading channel and a delay spread less than the cyclic prefix
length. It is important to remember that using OFDM as a modulation scheme allows the
assumption of a flat fading channel for each sub-carrier.

Figure 6.5. Alamouti for two transmit antennas.

Figure 6.6. Alamouti for one receive antenna.

The Alamouti scheme takes advantage of the spacial dimension by transmitting s1


from antenna 1 and s2 from antenna 2 where si are the OFDM symbols to be transmitted.
Then, s2 and s1 are sent from antennas 1 and 2 respectively, as seen in Table 6.1.
116
Table 6.1. Alamouti Transmission
Scheme
Antenna 1 Antenna 2
Time t s1 s2

Time t+T s2 s1

Since two symbols are transmitted during two time periods, the coding scheme has
rate 1. Thus, for the antenna scheme in Figure 6.7, the received signals are

y1 = H 1 s 1 + H 2 s 2 + 1 (6.1)
y2 = H1 s2 + H2 s1 2 , (6.2)

where yk is the received signal for the k th antenna, Hk is the multipath channel from the k th
transmit antenna, and i is the additive noise for the ith symbol period.

Figure 6.7. Channel for two transmit


antennas and one receive antenna.

At the receiver, the received signal is demodulated with the FFT after the removal of
the cyclic prefix and each subchannel undergoes decoding. The two received symbols for the
nth subchannel are

y 1 = a1 x 1 + a2 x 2 + 1 (6.3)
y2 = a1 x2 + a2 x1 + 2 , (6.4)

where yl is the received symbol on the nth subcarrier from the lth OFDM symbol, xm is the
mth symbol, ak is the flat fading channel gain for the nth subcarrier from antenna k, and is
117
as before. Rewriting as vectors we have
" #
h i x
1
y 1 = a1 a2 + 1 (6.5)
x2
" #
h i x
2
y 2 = a1 a2 + 2 (6.6)
x1
(6.7)

and combining both received symbols into one equation, we have


" # " #" # " #
y1 a1 a2 x1 1

=
+ . (6.8)
y2 a2 a1 x2 2
For convenience let " #
a1 a2
A= . (6.9)
a2 a1
Then to solve for the symbols x1 and x2 we need the inverse of A. For A to have an inverse it
needs to be square and have determinant zero. To avoid such a case, we will use the
Moore-Penrose psuedoinverse, A+ = (AH A)1 AH . Solving for A+ , we have
" #" #

a a 2 a 1 a 2
AH A = 1 (6.10)
a2 a1 a2 a1
" #
|h1 |2 + |h2 |2 0
= (6.11)
0 |h1 |2 + |h2 |2
" 1
#
1 2 2 0
AH A = |h1 | +|h2 |

1
. (6.12)
0 2
|h | +|h | 2
1 2

Thus, we have
" # " #
x1 1 y1
= AH A AH

(6.13)
x2 y2
" 1
# " # " #!
2 2 0 x1 1
= |h1 | +|h2 | 1
A H
A + (6.14)
0 |h1 |2 +|h2 |2
x2 2
" # " #
x1 1 1
+ AH A AH .

= (6.15)
x2 2
For the case of two receive antennas, as seen in Figure 6.8, the received symbols for
th
the n subcarrier on antenna 1 are
" # " #" # " #
y11 a11 a12 x1 n11
= + (6.16)
y21 a21 a22 x2 n12
118

Figure 6.8. Channel for two transmit


antennas and two receive antennas.

and the received symbols on antenna 2 are


" # " #" # " #
y11 a11 a12 x1 n11
= + . (6.17)
y21 a21 a22 x2 n12

Combining the two into one equation yields,



y11 a11 a12 " # n11
1 1
y2 a21 a22 x1 n2
= + . (6.18)
y 2 a a x n2
1 12 11 2 1
2
y2 a22 a21 n2
2

For convenience, we define


a11 a12

a21 a22
a a .
A= (6.19)
12 11
a22 a21
As before, we define the Moore-Penrose pseudoinverse as A+ = (AH A)1 AH and solving for
(AH A)1 we have

" a
# 11 a 12


a 11 a 21 a 12 a 22 a 21 a 22
AH A =

(6.20)
a12 a22 a22 a21 a
12

a
11
a22 a21
" #
|a1 1|2 + |a2 1|2 + |a1 2|2 + |a2 2|2 0
= (6.21)
0 |a1 1|2 + |a2 1|2 + |a1 2|2 + |a2 2|2
119
" 1
#
1 |a11 | +|a21 | +|a12 |2 +|a22 |2
2 2 0
AH A = 1
. (6.22)
0 |a11 | +|a21 | +|a12 |2 +|a22 |2
2 2

Solving for the received symbols we have



1
" # y 1
1 H y21

x1 H
= A A A
y 2 (6.23)
x2 1
y22

n11
1 H n12

H
= A A A n2
(6.24)
1
n2
2

1
" # n 1
1
x1 1 H n2
+ AH A

= n2 .
A (6.25)
x2 1
n2
2

Both schemes show the need for an accurate channel estimation to find the channel
inverse. This is discussed in section 6.5.

6.2 V ITERBI D ECODER


The Viterbi algorithm was developed in 1967 by Andrew Viterbi, which is essentially
a maximum likelihood decoder [18]. The Viterbi decoders complexity is not dependent on
the number of symbols in a codeword sequence and takes advantage of the structure of the
trellis diagram, to further reduce the computations. Two implementations of the Viterbi
decoder used are the hard decision decoder and the soft decision decoder.

6.2.1 Hard Decision Viterbi Decoder


In the convolutional encoder in Figure 6.2, there are two outputs for each input.
Hence, to decode, we take two bits at a time and compute the hamming distance, the branch
metric, the path metric, and the surviving path. The Hamming distance is the number of bits in
error between the received and transmitted sequence. The branch metric is the sum of the path
metric and the Hamming distance and the path metric is the minimum of the branch metrics
for each state. The hard decision decoder has input of one bit precision binary symbols.
As an example, suppose the received bit sequence from the four state encoder in
Figure 6.2 is 01, 01, 10, 01, 00 with the assumption that the encoder has initial state 00 and is
known at the receiver. Figure 6.9 shows the trellis diagram with the ordered pair (Hamming
distance, branch metric) and the path metric labeled at each state.
120

Figure 6.9. Viterbi decoding algorithm.

In Figure 6.9, the most likely path is the path whose metric is lowest, which is in red.
At each time interval the Hamming distance is computed as the number of bits in error from
the received bits and the output of the encoder between states. Note that for t 3, each state
has two previous states in common. This is where the branch metrics are compared and the
lowest is chosen. In the event that both branch metrics are the same, as is the case for state
(11) at t = 4 in Figure 6.9, the path can be chosen randomly or by a constant decision such as
the top or bottom path. The (10) state at t = 5 has the lowest accumulated error so starting
from this state the decoder traces back following the lowest branch metric. The progression of
states from t = 0 to t = 5 is 00, 10, 11, 11, 01, 10. Table 6.2 shows the state transitions and the
input to the convolutional encoder.

Table 6.2. Encoder Transition


and Inputs
State Transition Encoder Input
00 10 1
10 11 1
11 11 1
11 01 0
01 10 1

Thus, the most likely input sequence was 1, 1, 1, 0, 1 with one received error. In this
example the trellis diagram for the entire sequence was computed but in practice this is not
practical for long sequences as this will increase the amount of delay. The length of the trellis
used is called the traceback depth and it is clear from the example at t = 1 that too short of a
traceback depth causes errors in the decoding. The general rule is a traceback depth of five
121
times the constraint length and depths greater than this do not see much improvement in
performance. The exact traceback or decision depth is found by simulation in practice
although analytic traceback techniques exist based on the free distance. If puncturing is
applied, the traceback depth is increased to 7 to 9 times the constraint length.

6.2.2 Soft Decision Viterbi Decoding


The soft decision Viterbi decoder is similar to the hard decision decoder but instead of
using one bit precision, multiple bits are used to convey the reliability of the values. Table 6.3
shows one such scheme for three bit precision. Figure 6.10 shows the relationship between
the input and output for the three bit quantized soft decision decoder.

Table 6.3. Soft Decision Viterbi


Decoder
Quantized level Reliability
000 Strongest 0
001 Relatively Strong 0
010 Relatively Weak 0
011 Weak 0
100 Weak 1
101 Relatively Weak 1
110 Relatively Strong 1
111 Strongest 1

The decision value D is computed as


s
1 1
D= Es
(6.26)
2 2N 0

Es

where N 0
is the symbol signal to noise ratio. The width of the decision regions is N 0 2k
where k is the bit precision and N0 is the noise PSD. The branch and path metrics are
computed with the three bit values and the add, compare, and select (ACS) algorithm of the
hard decision decoder is applied. Figure 6.11 shows a comparison of the hard and soft
decision decoders.

6.3 S PATIAL D IVISION M ULTIPLEXING


Spatial division multiplexing (SDM) is a technique used to transmit independent data
streams from each antenna at the same time and carrier frequency. To separate the signals
which interfere with each other, the number of receive antennas must be greater than or equal
to the number of transmit antennas and knowledge of the channel is needed at the receiver.
The decoding is, in general, less complex than STCs.
122

Three bit quantizer input/output relationship


111>7

110>6

101>5

100>4
Output

011>3

010>2

001>1

000>0
3D 2D 1D 1D 2D 3D
Input decision level
Figure 6.10. Input/output relationship for 3 bit quantizer.
123

BER for Binary Convolutional Code with Viterbi decoding for BPSK in AWGN
Theoretical Uncoded
Simulation Hard Viterbi
Simulation Soft Viterbi
1
10

2
10
Bit Error Rate

3
10

4
10

5
10
0 1 2 3 4 5 6 7 8 9 10
Eb/No [dB]

Figure 6.11. Comparison of hard and soft Viterbi decoding.


124
We consider two types of spatial multiplexing developed at Bell labs. Diagonal Bell
labs layer space time (D-BLAST) transmits successive encoded data symbols on different
antennas in a cyclic fashion. Vertical Bell labs layered space time (V-BLAST) is much less
computationally intensive than D-BLAST with the detection at the receiver performed
vertically at each time interval. Figure 6.12 shows the encoder and the output for both
D-BLAST and V-BLAST [6].

Figure 6.12. D-BLAST and V-BLAST layered transmission scheme.

As seen in Figure 6.12, both the D-BLAST and the V-BLAST encoders demultiplex
the incoming bit stream into parallel substreams using a serial to parallel conversion where
each substream is then encoded separately. For V-BLAST, the substreams are then transmitted
on separate antennas, but for D-BLAST, the substreams are distributed across the different
antennas in layers.
The decoding process for D-BLAST is more computationally intensive than that of
V-BLAST and increases in computational load with increasing number of transmit
antennas[6]. Notice that at t = 0 only one antenna is transmitting so receiving the symbol is
straight forward. At t = 1 the next symbol in the layer (substream) has interference from a
second antenna. Receiving the second symbol in the layer requires the use of minimum mean
square error (MMSE) or zero forcing nulling (ZF-nulling) to ignore the symbol interference
from the next layer [6]. The process continues until the layer has been received and then is
decoded. This decoded layer is then subtracted from the next layer and the process continues.
It is vital that the decoding of the layer is error free as it affects the decoding of the successive
layers. Because the layer cannot be decoded until all the symbols in the layer are received a
delay is introduced and there is a loss in capacity at the startup.
The decoding process for V-BLAST is less computationally intensive and involves
three basic steps: filtering, slicing, and cancellation. If channel coding is used in conjunction
125
with V-BLAST, then the demodulated symbols must be buffered until the block can be
decoded. Several other types of decoders that can be used such as the maximum likelihood
(ML) decoder, zero forcing (ZF), and minimum mean square error (MMSE). An iterative
method can also be applied by ordereing the spatial streams by SNR. The stream with the
highest SNR is decoded first, treating the others as noise and then is canceled so the next
highest SNR stream can be decoded [29].

6.4 B EAMFORMING
Some of the earliest examples of beamforming were seen in sonar where multiple
transmit arrays would employ delays to direct the coverage area to the intended target. By
directing the coverage area in wireless devices, the number of users can be increased as
coverage can be extended or shaped to include only certain users as needed and the
interference from multiple users can be reduced as seen in Figure 6.13. Beamforming is an
option in the IEEE802.11n standard [15] and other communication standards like IEEE802.16
(WiMAX). Future amendments to IEEE802.11 will include beamforming as a means to
achieving data rates in the multi Gbps [20].
There are several ways to achieve beamforming but here we consider a technique
where each transmit antenna transmits the same signal at the same frequency but with a phase
shift. As an example, suppose we have the three transmit antennas in the configuration seen in
Figure 6.14.
We want to find the contribution from each antenna to the point A in Figure 6.14:
q  q 
2 2 2 2
S(, r) = s0 (r) + s1 x1 + y1 + 1 + s 2 x2 + y2 + 2 (6.27)
q  q 
= s0 (r) + s1 (d r cos )2( r sin )2 + 1 + s2 (r cos 2d)2( r sin )2 + 1
(6.28)
(N 1)/2 p 
X
= sn (r cos nd)2 + (r sin )2 + n . (6.29)
n=(N 1)/2

In equation 6.29, S(, r) is the signal strength at the point (, r) from the center antenna, sn ()
is the signal strength from the nth antenna, N is the number of antennas (here it must be odd),
and n is the time delay for the nth antenna. Figure 6.15 demonstrates the signal strength for
three and five antenna configurations. For convenience n = n1 , that is, the delays are
integer multiples of 1 .

6.5 C HANNEL E STIMATION


As seen in previous sections, accurate estimation of the channel is useful and in some
cases necessary. In Section 5.2.5 we discussed a method of using the long training symbols to
126

Figure 6.13. Directing coverage area to


intended users using beamforming.

Figure 6.14. Three isotropic antenna configuration.


127

3 Antennas, Distance = 10, Relative phase delay = 10 3 Antennas, Distance = 10, Relative phase delay = 40

90 90
1 1
120 60 120 60

0.8 0.8

0.6 0.6
150 30 150 30

0.4 0.4

0.2 0.2

180 0 180 0

210 330 210 330

240 300 240 300

270 270

5 Antennas, Distance = 5, Relative phase delay = 25 5 Antennas, Distance = 5, Relative phase delay = 40

90 90
1 1
120 60 120 60

0.8 0.8

0.6 0.6
150 30 150 30

0.4 0.4

0.2 0.2

180 0 180 0

210 330 210 330

240 300 240 300

270 270

Figure 6.15. Signal strength for (a) three antennas, distance 10, and relative phase delay
10, (b) three antennas, distance 10, and relative phase delay 40, (c) five antennas,
distance 2, and relative phase delay 25, and (d) five antennas, distance 5, and relative
phase delay 40.
128
estimate the channel, but this was for the single-input single-output case. Here we consider a
scheme also using training symbols for the multiple input multiple output case as seen in
Figure 6.16.

Figure 6.16. MIMO channel.

As before, the received signal is

Y [k] = H[k]X[k] + Z[k] (6.30)

where X is the frequency domain symbol, H is the channel frequency response and Z is the
frequency response of the noise. The channel estimate is then
Y [k]
H[k] = (6.31)
X[k]
and the inverse of the channel estimate is then
2
H[k] = H[k]H [k] (6.32)

H [k]
H 1 [k] = . (6.33)
2
H [k]

As before, to find the estimate of the channel, the transmitted symbol must be known at the
receiver. Again, we use the long training symbols but there are two techniques to implement
them. The first is to transmit one training symbol on each transmitter as seen in Figure 6.17.
The procedure for extracting the channel estimates is then reduced to two SISO channel
estimates.
129

Figure 6.17. Alternate transmission of long preamble.

The second is to transmit the even frequency bins from antenna one and the odd
frequency bins from antenna two. Then in the next symbol period transmit the odd frequency
bins from antenna one and the even frequency bins from the antenna two, as seen in
Figure 6.18. To extract the channel estimates, the same procedure is employed as with the
SISO channel, with the exception that even and odd frequency bins need to be taken into
account.

Figure 6.18. Alternating even and odd frequencies.


130

CHAPTER 7
CONCLUSION
This thesis presented an introduction to MIMO-OFDM, specifically, the topics of the
channel, OFDM, synchronization, and MIMO. Mathematical descriptions of the channel,
OFDM, and synchronization, were given as well as MATLAB simulations to verify, illustrate
concepts, or present a practical implementation. Chapter two detailed the effects present in a
wireless multipath channel and the importance of the channel model. To that end, a frequency
domain channel model was given and simulated for the wireless multipath fading channel.
Chapter three briefly reviewed some of the modulation schemes used in digital
communications and used throughout this thesis. Chapter four gave a comparison of single
carrier systems and multicarrier systems as the motivation for OFDM. Mathematical
definitions were presented on modulation and demodulation in the presence of a channel. This
gave a basis for understanding the synchronization errors common to OFDM.
In Chapter five, a detailed discussion of synchronization errors was presented.
Mathematical descriptions of the errors and simulations of the errors were presented to
illustrate the effect that timing and frequency offsets have on the uncoded constellations. The
second half of Chapter five showed how the synchronization errors could be estimated at the
receiver and corrected. For each type of synchronization error, algorithms were presented and
implemented in a MATLAB simulation. As an extension to OFDM, Chapter six presented
MIMO as a way to increase performance in a communication system. Three topics were
showcased along with examples of each. Space time coding techniques such as convolutional
codes and the Alamouti algorithm were shown to increase the reliability by transmitting
multiple copies. Both had coding gains but the Alamouti scheme also introduced spatial gain.
A maximum likelihood detector, the Viterbi decoder, was also presented as a way to decode
the convolutional encoder. Two types of spatial multiplexing, D-BLAST and V-BLAST, were
shown to be an effective way to increase the overall data rate by transmitting multiple
independent streams. Lastly, beamforming was introduced as a way to direct the coverage
area. In this way, more users can be serviced by the reduction of interference from multiple
users. It is hoped that after reading this thesis the reader has a better understanding of channel
models, MIMO-OFDM, the effects of the channel on OFDM, and the ways in which errors
are estimated and corrected.
This thesis aimed to be an introductory look into OFDM. Future systems will include
MIMO-OFDM and, as such, there is a lot of research being done in this area. One of the
131
assumptions made about the channel was that it was static. While this assumption works well
for standards such as IEEE802.11, it does not work well for cell phones and other wireless
devices. In the future, we may see many devices that must be able to operate at speeds were
Doppler shifts affect data transmission.
Another consideration is the techniques used in space time coding. Turbo codes and
low density parity-check codes are now replacing convolutional codes. Also, only the 2x2
MIMO case was considered for STBCs.
132

BIBLIOGRAPHY

[1] S. A LAMOUTI, A simple transmit diversity technique for wireless communications,


IEEE Journal on Selected Areas in Communications, 16 (1998), pp. 1451 1458.
[2] A. A NTONIOU, Digital Signal Processing, McGraw-Hill, New York, New York, 2006.
[3] R. C HANG, Synthesis of band-limited orthogonal signals for multi-channel data
transmission, Bell System Technical Journal, 46 (1966), pp. 17751796.
[4] C ISCO. Cisco visual networking index: global mobile data traffic forecast update. n.d.
http://www.cisco.com/en/US/solutions/collateral/ns341/ns525/ns537/ns705/ns827/
white paper c11-520862.html, accessed November 2011.
[5] N. E GASHIRA , H. TAKAYAMA , AND T. S ABA, Improvement of cci compensation
accuracy using feedback phase tracking in mimo-ofdm systems, in Global
Telecommunications Conference 2004., vol. 2, Dallas, Texas, 2004, IEEE.
[6] G. J. F OSCHINI, Layered space-time architecture for wireless communication in a
fading environment when using multi-element antennas, Bell Laboratories Technical
Journal, 1 (1996), pp. 4159.
[7] R. G. G ALLAGER, Principles of Digital Communications, Cambridge University Press,
Cambridge, UK, 2008.
[8] F. HARRIS, Lets assume the system is synchronized, in Globalization of Mobile and
Wireless Communications, R. Prasad, S. Dixit, R. van Nee, and T. Ojanpera, eds.,
Signals and Communication Technology, Springer, Netherlands, 2011, pp. 311325.
[9] F. J . HARRIS, Orthogonal frequency division multiplexing. Unpublished notes, 2010.
[10] H. H ASHEMI, The indoor radio propagation channel, Proceedings of the IEEE, 81(7)
(1993), pp. 943 968.
[11] V. H AYES ET AL ., Ieee standard for information technology- telecommunications and
information exchange between systems-local and metropolitan area networks-specific
requirements-part 11: Wireless lan medium access control (mac) and physical layer
(phy) specifications, IEEE Std 802.11-1997, (1997), pp. i 445.
[12] , Supplement to ieee standard for information technology - telecommunications and
information exchange between systems - local and metropolitan area networks - specific
requirements. part 11: Wireless lan medium access control (mac) and physical layer
(phy) specifications: High-speed physical layer in the 5 ghz band, IEEE Std
802.11a-1999, (1999), pp. i 82.
[13] G. JANSSEN , P. S TIGTER , AND R. P RASAD, Wideband indoor channel measurements
and ber analysis of frequency selective multipath channels at 2.4, 4.75, and 11.5 ghz,
IEEE Transactions on Communications, 44 (1996), pp. 1272 1288.
[14] S. J. K ERRY ET AL ., Ieee standard for information technology- telecommunications and
133
information exchange between systems- local and metropolitan area networks- specific
requirements part ii: Wireless lan medium access control (mac) and physical layer (phy)
specifications, IEEE Std 802.11g-2003 (Amendment to IEEE Std 802.11, 1999 Edn.
(Reaff 2003) as amended by IEEE Stds 802.11a-1999, 802.11b-1999, 802.11b-1999/Cor
1-2001, and 802.11d-2001), (2003), pp. i 67.
[15] , Ieee standard for information technologytelecommunications and information
exchange between systemslocal and metropolitan area networksspecific requirements
part 11: Wireless lan medium access control (mac) and physical layer (phy)
specifications amendment 5: Enhancements for higher throughput, IEEE Std
802.11n-2009 (Amendment to IEEE Std 802.11-2007 as amended by IEEE Std
802.11k-2008, IEEE Std 802.11r-2008, IEEE Std 802.11y-2008, and IEEE Std
802.11w-2009), (2009), pp. c1 502.
[16] R. V. N EE AND R. P RASAD, OFDM for Wireless Multimedia Communications, Artech
House Publishers, Boston, Massachusettes, 2000.
[17] H. N IKOOKAR AND H. H ASHEMI, Phase modeling of indoor radio propagation
channels, IEEE Transactions on Vehicular Technology, 49 (2000), pp. 594 606.
[18] J. O MURA, On the viterbi decoding algorithm, IEEE Transactions on Information
Theory, 15 (1969), pp. 177 179.
[19] P. V. ON EIL, Advanced Engineering Mathematics, PWS-Kent Publishing Company,
Boston, Massachusetts, 4 ed., 1995.
[20] E. P ERAHIA , C. C ORDEIRO , M. PARK , AND L. YANG, Ieee 802.11ad: Defining the
next generation multi-gbps wi-fi, in Consumer Communications and Networking
Conference, Las Vegas, NV, jan. 2010, IEEE, pp. 1 5.
[21] R. P RASAD, OFDM Wireless Communications Systems, Artech House Publishers,
Boston, Massachusetts, 2004.
[22] S. S ANDHU , R. H EATH , AND A. PAULRAJ, Space-time block codes versus space-time
trellis codes, in IEEE International Conference on Communications, vol. 4, Helsink,
Finland, 2001, IEEE, pp. 1132 1136.
[23] T. S CHMIDL AND D. C OX, Low-overhead, low-complexity [burst] synchronization for
ofdm, in IEEE International Conference on Communications., Dallas, Tx, 1996, IEEE.
[24] B. S KLAR, Digital Communications: Fundamentals and Applications, Prentice Hall,
Upper Saddle River, New Jersey, 2nd ed., 2001.
[25] M. S PETH , S. F ECHTEL , G. F OCK , AND H. M EYR, Optimum receiver design for
wireless broad-band systems using ofdm. i, IEEE Transactions on Communications, 47
(1999), pp. 1668 1677.
[26] D. T SE AND P. V ISWANATH, Fundamentals of Wireless Communication, Cambridge
University Press, Cambridge, UK, 2005.
[27] L. V ERMA AND S. L EE, Proliferation of wi-fi: Opportunities in ce ecosystem, in
Consumer Communications and Networking Conference, Las Vegas, NV, 2011, IEEE,
134
pp. 213 217.
[28] S. W EINSTEIN AND P. E BERT, Data transmission by frequency-division multiplexing
using the discrete fourier transform, IEEE Transactions on Communication Technology,
19 (1971), pp. 628 634.
[29] P. W OLNIANSKY, G. F OSCHINI , G. G OLDEN , AND R. VALENZUELA, V-blast: an
architecture for realizing very high data rates over the rich-scattering wireless channel,
in URSI International Symposium on Signals, Systems, and Electronics, Palazzo Dei
Congressi, Pisa, Italy, sep-2 oct 1998, IEEE, pp. 295 300.
135

APPENDIX A
MATLAB CODE FOR CHANNEL MODELING
136

MATLAB CODE FOR CHANNEL MODELING

1 %% ---------------------------------------------------------
2 % Steven Hemple
3 % channel1.m
4 %
5 % This MATLAB script plots the recieved energy as a function
6 % of distance thus describing the effects of path loss.
7 %-----------------------------------------------------------
8 clear all;
9 close all;
10 clc;
11

12 Screen 0=[550,10,800,650];
13 Screen 1=[1400,10,800,650];
14 Screen 2=[1360,-310,1920,1024];
15 Position=Screen 0;
16 Plots=1;
17 %% ---------------------------------------------------------
18 % Parameters
19 % ----------------------------------------------------------
20 d1=0.026438:.001:100;
21 d2=0.000001:.001:.05;
22 c=2.99*108;
23 f=900*106;
24 lamda=c/f;
25 B=[1 1 1 1 1];
26 theta=[0 0 0 0 0];
27 W=1;
28 T=1/(W);
29 freq=0:.001:W;
30 H=zeros(1,length(f));
31 %% ---------------------------------------------------------
32 % Free space path loss model for large distances
33 % ----------------------------------------------------------
34 L1=20*log10(((4*pi.*d1*f)/c));
35 figure('position',Position)
36 subplot(1,2,1)
37 plot(d1,-L1)
137

38 grid on;
39 axis([-10 100 -80 10]);
40 title({['Free Space Path Loss'];...
41 ['as a Function of Distance']},'FontSize',16);
42 xlabel('Distance [m]');
43 ylabel('Magnitude [dB]');
44

45 %% ---------------------------------------------------------
46 % Free space path loss model for small distances
47 % ----------------------------------------------------------
48 L2=20*log10(((4*pi.*d2*f)/c));
49 subplot(1,2,2)
50 plot(d2,-L2)
51 grid on;
52 axis([-.005 0.05 -10 100]);
53 title({['Free Space Path Loss Model'];...
54 ['as a Function of Distance'];...
55 ['For Small Distances.']},'FontSize',16);
56 xlabel('Distance [m]','FontSize',12);
57 ylabel('Magnitude [dB]','FontSize',12);
58

59

60 %% ---------------------------------------------------------
61 % Doppler shift as a function of antenna speed and angle
62 % relative to the transmit antenna
63 % ----------------------------------------------------------
64 f c=900*106;
65 c=2.99*108;
66 v=[0:2.25:100];
67 angle=linspace(-pi,pi,length(v));
68 [X,Y]=meshgrid(v,angle);
69 Z=X/c* f c. *cos(Y);
70

71 figure('position',Position)
72 surf(X,Y,Z)%,'EdgeColor','none')
73 colormap(jet);
74 hold on
75 x=0:.01:100;
76 y=-pi/2*ones(1,length(x));
77 z=zeros(1,length(x));
78 plot3(x,y,z,'-.k','linewidth',2)
79 plot3(x,-y,z,'-.k','linewidth',2)
80 plot3(zeros(1,length(x)),y,linspace(-400,0,length(x)),...
81 '-.k','linewidth',2)
138

82 plot3(zeros(1,length(x)),-y,linspace(-400,0,length(x)),...
83 '-.k','linewidth',2)
84 title('Doppler Shift as a Function of Speed and Angle ...
85 Relative to Transmit Antenna'...
86 ,'FontSize',16)
87 xlabel('Speed [m/s]','FontSize',12);
88 ylabel('Angle [Radians]','FontSize',12);
89 zlabel('Doppler Shift [Hz]','FontSize',12)
90 set(gca,'YTick',-pi:pi/2:pi)
91 set(gca,'YTickLabel',{'-pi','-pi/2','0','pi/2','pi'})
92

93 %% ---------------------------------------------------------
94 % Generate the channel transfer function
95 %-----------------------------------------------------------
96 for i=1:length(B)
97 H=H+B(i)*exp(-1j*2*pi.*freq*(i*T)+theta(i));
98 end
99 figure('position',Position)
100 plot(freq/W-0.5,20*log10(fftshift(abs(H))))
101 hold on
102 plot([-0.5 0.5],...
103 [20*log10(max(abs(H))/2) 20*log10(max(abs(H))/2)],'r')
104 axis([-0.5 0.5 -40 20]);
105 hold off
106 grid on
107 title({['Channel Transfer Function for'];...
108 ['\beta k=1 and \theta k=0']},'FontSize',16)
109 xlabel('Normalized Frequency f/fsym [Hz]','FontSize',12)
110 ylabel('Magnitude2 [dB]','FontSize',12);
111 mTextBox = uicontrol('style','text');
112 set(mTextBox,'String','-6dB');
113 set(mTextBox,'Position',[380 450 60 30]);
114 set(mTextBox,'BackgroundColor','w');
115 set(mTextBox,'Fontsize',12);
116

117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119

120 %% -- cohere1.m --------------------------------------------


121 % MATLAB Thesis Simulation
122 % Steven Hemple
123 % cohere1.m
124 %
125 % This MATLAB script will simulate the superposition of
139

126 % waveforms.
127 % ----------------------------------------------------------
128 clc;
129 clear all;
130 close all;
131

132 % -- Plot Parameters ---------------------------------------


133 %
134 % Screen 0 =Size and position of plots for screen 0
135 % Screen 1 =Size and position of plots for dual monitors
136 % Screen 1 =Size and position of plots for HDMI Out
137 % (1080i)
138 % Position =Plot screen variable
139 % Plots =Toggle to turn plots on(1) or off(0)
140 % ----------------------------------------------------------
141 Screen 0=[550,10,800,650];
142 Screen 1=[1400,10,800,650];
143 Screen 2=[1360,-310,1920,1024];
144 Position=Screen 0;
145 Plots=1;
146

147 %% ---------------------------------------------------------
148 % Calculate superposition of waveforms for phase differences
149 % of {0, pi/8, pi/4, pi/2, 3pi/4, pi}.
150 % ----------------------------------------------------------
151 d=[0 pi/8 pi/4 pi/2 3*pi/4 pi];
152 for i=1:length(d)
153 if d(i)==0
154 a=('Full Wavelength');
155 elseif d(i)==pi/8
156 a=('1/16 Wavelength');
157 elseif d(i)==pi/4;
158 a=('1/8 Wavelength');
159 elseif d(i)==pi/2
160 a=('1/4 Wavelength');
161 elseif d(i)==3*pi/4
162 a=('3/8 Wavelength');
163 elseif d(i)==pi
164 a=('1/2 Wavelength');
165 else
166 a=('');
167 end
168

169 t=0:.01:10;
140

170 f=sin(2*pi*.5.*t);
171 g=sin(2*pi*.5.*t-d(i));
172 h=f+g;
173

174 figure('position',Position)
175 subplot(2,1,1)
176 plot(t,f,'LineWidth',3)
177 grid on
178 hold on
179 plot(t,g,'--r','LineWidth',2)
180 grid on
181 title({['Two Waveforms With Phase Difference ',a,'.']},...
182 'FontSize',16)
183 set(gca, 'XTick', [])
184 subplot(2,1,2)
185 plot(t,h,'k','LineWidth',2)
186 grid on
187 set(gca, 'XTick', [])
188 set(gca,'Ylim',[-2 2]);
189 title('The Received Waveform','FontSize',16)
190 end
191

192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194

195 %% ---------------------------------------------------------
196 % Steven Hemple
197 % Thesis Simulations
198 % FDmodel.m
199 %
200 % This MATLAB script usees the frequency domain channel
201 % model presented in Ramjee Prasad's text. Pararmeters were
202 % chosen from the texts observed data.
203 % ----------------------------------------------------------
204 clc;
205 clear all;
206 close all;
207

208 % -- Simulation Parameters ---------------------------------


209 %
210 % Screen 0 =Size and position of plots for screen 0
211 % Screen 1 =Size and position of plots for screen 1
212 % Screen 1 =Size and position of plots for dual monitor
213 % Position =Plot screen variable
141

214 % Plots =Toggle to turn plots on(1) or off(0)


215 % ----------------------------------------------------------
216 Screen 0=[550,10,800,650];
217 Screen 1=[1400,10,800,650];
218 Screen 2=[];
219 Position=Screen 0;
220 Plots=1;
221

222 %% ---------------------------------------------------------
223 % Parameters of the channel
224 % Sim num = Number of simulations
225 % N = Length of transfer function
226 % W = Sampling frequency [Hz]
227 % P 0 dB = Normalized Received Power [dB]
228 % K dB = Rician K-factor [dB]
229 % tau RMS = RMS Delay Spread [s] (Second Central
230 % Moment or Standard deviation)
231 % tau 1 = End of constant part of DPS [s]
232 % ----------------------------------------------------------
233 Sim num=3000;
234 N=801;
235 W=1e9;
236 P 0 dB=-62.1;
237 K dB=-1.9;
238 tau rms=9e-9;
239 tau 1=0;
240

241 %%----------------------------------------------------------
242 % Convert channel parameters to simulation parameters
243 %
244 % P 0 = magnitude of P 0
245 % K = magnitude of K
246 % gamma = The decay exponent of the exponentially
247 % decaying part of DPS [Hz]
248 % PI = The normalized power density of constant part
249 % of DPS [Hz]
250 % f = frequency bin lengths [Hz]
251 % sigma sqrd= variance of real valued noise samples
252 % rho sqrd = Normalized power of the direct ray
253 % psi = Normalized power of scatterd components
254 % tau max = Maximum excess delay
255 % T = Sample time
256 % nTot = Number of samples in half bandwidth
257 % n1 = tau 1 the constant level edge of DPS
142

258 % n2 = Excess bandwidth to allow for transition


259 % ----------------------------------------------------------
260 P 0=10(P 0 dB/10);
261 K=10(K dB/10);
262 rho sqrd=P 0 *K/(K+1);
263 gamma=(1/tau rms)*(sqrt(2*K+1)/(K+1));
264 PI=(P 0 *gamma)/(K+1);
265 F=W/N;
266 sigma sqrd=PI/(4*F);
267 psi=P 0/(2*(K+1));
268 tau max=tau 1+10/gamma;
269 T=1/W;

270

271 %% ---------------------------------------------------------
272 % Generate theoretical delay power spectrum
273 %
274 % { 1 | tau | | tau | tau 1
275 % G(tau)={
276 % { exp(-gamma ( | tau | -tau 1) | tau|>tau 1
277 %
278 % Simulation has TF and DPS with length N=801
279 %
280 % f =Normalized frequencies
281 % a =Theoretical delay power spectrum
282 % w =Weights for filter using least squares
283 % g =Filter using least squares
284 % ht =Filter for Hilbert transform
285 % ha =Channel impulse response
286 % H =Channel frequency response
287 %
288 % ----------------------------------------------------------
289 n end=(N-1)/2;
290 n 1=round(tau 1/ T)+1;
291 n 2=round(tau max/ T)+1;
292

293 if mod(n 2,2)


294 n 2=n 2+1;
295 end
296

297 tau=(0:n end-1)* T;


298 f=(0:n end-1)/(n end-1);
299 a1=[ones(1,n 1) exp(-gamma/2*[tau(n 1+1:n 2)-tau 1]) ...
300 ones(1,n end-n 2)*exp(-gamma/2*(tau(n 2)))];
301 a=[ones(1,n 1) exp(-gamma/2*[tau(n 1+1:n 2+2)-tau 1]) ...
143

302 ones(1,n end-n 2-2)*exp(-gamma/2*(tau(n 2+2)))];


303

304 w=[ones(1,n 2/2+1) 50*ones(1,n end/2-n 2/2-1)];


305

306 g=firls(180,f,a,w);
307 g=g/sum(g);
308

309 G=fftshift((fft(g,N)));
310 if Plots
311 figure('name','Channel Simulation- Delay Power Spectrum',...
312 'position',Position')
313 plot(1:length(a),20*log10(a),'-.b','linewidth',4)
314 hold on
315 plot(-(N-1)/2:(N-1)/2,20*log10(abs(G)),'r',...
316 'linewidth',2)
317 axis([-400 400 -60 10]);
318 title('Delay Power Spectrum','FontSize',16)
319 xlabel('Exces Delay [ns]','FontSize',12)
320 ylabel('Magnitude [dB]','FontSize',12)
321 h=legend('Theoretical','Simulated');
322 set(h,'FontSize',12);
323 end
324 % Hilbert Transform by low pass filter
325 ht=firls(560,[0.007 .99],[1 1],'hilbert');
326

327 h=conv(ht,g*max(g)/.125);
328 H=fftshift(abs(fft(h,N)));
329

330 if Plots
331 figure('name',...
332 'Channel Simulation- Causal Noise Shapping Filter',...
333 'position',Position')
334 plot(1:length(a1),20*log10(a),'-.b','linewidth',4)
335 hold on
336 plot(-(N-1)/2:(N-1)/2,20*log10(([-H(1:(N-1)/2)...
337 H((N-1)/2+1:end)]+H)),'r','linewidth',2)
338 axis([-5 400 -60 10]);
339 title('Causal Noise Shapping Filter','FontSize',16)
340 xlabel('Excess Delay [ns]','FontSize',12)
341 ylabel('Magnitude [dB]','FontSize',12)
342 h=legend('Theoretical','Simulated');
343 set(h,'FontSize',12);
344 end
345
144

346 %% ---------------------------------------------------------
347 % Gnenerate noise with parameters from channel
348 % ----------------------------------------------------------
349 H f=zeros(Sim num,N);
350

351 for ii=1:Sim num


352 n t=sqrt(PI/(4*F))*randn(1,N);
353 h1=conv(n t,g);
354 h1=h1((length(h1)-1)/2-400:(length(h1)-1)/2+400);
355 h2=conv(h1,ht);
356 h2=h2((length(h2)-1)/2-(N-1)/2:(length(h2)-1)/2+(N-1)/2);
357 H=complex(h1,-h2);
358 H=H+sqrt(rho sqrd)*exp(1j*2*pi*rand);
359 H f(ii,:)=H;
360

361 end
362

363 [n,xout]=hist(abs(H f(:)),1000);


364 p=xout.*exp(-(xout.2+rho sqrd)/(2*psi)).*...
365 besseli(0,xout*sqrt(rho sqrd)/psi)/psi;
366

367 if Plots
368 figure('name','Channel Simulation- Channel Transfer Function',...
369 'position',Position')
370 plot((0:length(h1)-1)/(length(h1)-1)*1000,...
371 20*log10(abs(H)))
372 title('Channel Transfer Function','FontSize',16);
373 xlabel('Frequency [MHz]','FontSize',12);
374 ylabel(' | H(f)|2 [dB]','FontSize',12);
375

376 figure('name',...
377 'Channel Simulation- Phase of Channel Transfer Function',...
378 'position',Position')
379 plot((0:length(h1)-1)/(length(h1)-1)*1000,angle(H))
380 title('Phase of Transfer Function','FontSize',16);
381 xlabel('Frequency [MHz]','FontSize',12);
382 ylabel('Phase of H(f)','FontSize',12);
383

384

385 figure('name','Channel Simulation- Channel Impulse Response',...


386 'position',Position')
387 channel=fftshift(ifft(H));
388 plot((-(N-1)/2:(N-1)/2)/(N*F)*109,...
389 20*log10(abs(channel)),'-.k')
145

390 hold on
391 plot((0:(N-1)/2)/(N*F)*109,...
392 20*log10(abs(channel((N-1)/2+1:end))))
393 axis([-25 160 -115 -60]);
394 title('Channel Impulse Response','FontSize',16)
395 xlabel('Excess Delay \tau [ns]','FontSize',12)
396 ylabel(' | h(\tau)|2 [dB]','FontSize',12)
397

398 figure('name',...
399 'Channel Simulation- Normalized PDF Of Transfer...
400 Function Amplitudes','position',Position')
401 bar(xout,n/(sum(n)*(xout(2)-xout(1))))
402 hold on
403 plot(xout,p/(sum(p)*(xout(2)-xout(1))),'r',...
404 'linewidth',2)
405 title('Normalized PDF of Transfer Function Amplitudes',...
406 'FontSize',16)
407 xlabel('Amplitude | H(f ) | ','FontSize',12)
408 ylabel('PDF \rho ( | H(f)|)','FontSize',12)
409 h=legend('Simulated','Theoretical');
410 set(h,'FontSize',12);
411 end
146

APPENDIX B
MATLAB CODE FOR MODULATION
147

MATLAB CODE FOR MODULATION

1 %% -- AM.m -------------------------------------------------
2 % MATLAB Thesis Simulation
3 % Steven Hemple
4 %
5 % This MATLAB script will simulate double side band AM and
6 % double side band supressed crrier AM transmission.
7 % ----------------------------------------------------------
8 clc;
9 clear all;
10 close all;
11

12 % -- Plot Parameters ---------------------------------------


13 %
14 % Screen 0 =Size and position of plots for screen 0
15 % Screen 1 =Size and position of plots for dual monitors
16 % Screen 1 =Size and position of plots for HDMI Out
17 % (1080i)
18 % Position =Plot screen variable
19 % Plots =Toggle to turn plots on(1) or off(0)
20 % ----------------------------------------------------------
21 Screen 0=[550,10,800,650];
22 Screen 1=[1400,10,800,650];
23 Screen 2=[1360,-310,1920,1024];
24 Position=Screen 1;
25 Plots=1;
26

27 %% ---------------------------------------------------------
28 % Parameters
29 %
30 % t =Time
31 % M =Amplitude of message
32 % fm =Frequency
33 % m =Message
34 % A =Carrier frequency amplitude
35 % fc =Carrier center frequency
36 % c =Carrier waveform
37 % tx =Modulated message
148

38 % ----------------------------------------------------------
39 t=0:1/4096:1-1/4096;
40 M=1;
41 fm=40;
42 m=M*cos(2*pi*fm.*t);
43 A=1;
44 fc=200;
45 c=cos(2*pi*fc.*t);
46 tx=(A+m).*c;
47

48 %% ---------------------------------------------------------
49 % Time series and spectrum of signal
50 % ----------------------------------------------------------
51 figure('position',Position)
52 subplot(2,1,1)
53 plot(t,m)
54 title('Message','FontSize',16)
55 xlabel('Time [sec]','FontSize',12)
56 ylabel('Amplitude','FontSize',12)
57 axis([0 0.25 -1.1 1.1])
58

59 Mfft=fftshift(abs(fft(m,4096)));
60 subplot(2,1,2)
61 plot(4096*(-0.5:1/4096:0.5-1/4096),Mfft/4096)
62 title('Message Spectrum','FontSize',16)
63 xlabel('Frequency [Hz]','FontSize',12)
64 ylabel('Amplitude','FontSize',12)
65 axis([-100 100 0 .55])
66

67 %% ---------------------------------------------------------
68 % Carrier time series and spectrum
69 % ----------------------------------------------------------
70 figure('position',Position)
71 subplot(2,1,1)
72 plot(t,c)
73 title('Carrier Signal','FontSize',16)
74 xlabel('Time [sec]','FontSize',12)
75 ylabel('Amplitude','FontSize',12)
76 axis([0 .05 -1.1 1.1]);
77

78 C=fftshift(abs(fft(c,4096)));
79 subplot(2,1,2)
80 plot(4096*(-0.5:1/4096:0.5-1/4096),C/4096)
81 title('Carrier Spectrum','FontSize',16)
149

82 xlabel('Frequency [Hz]','FontSize',12)
83 ylabel('Amplitude','FontSize',12)
84 axis([-500 500 0 .55])
85

86 %% ---------------------------------------------------------
87 % Double side band AM modulation time series and spectrum
88 % ----------------------------------------------------------
89 figure('position',Position)
90 subplot(2,1,1)
91 plot(t,tx)
92 title('Double Side Band Full Carrier (DSB-AM)','FontSize',16)
93 xlabel('Time [sec]','FontSize',12)
94 ylabel('Amplitude','FontSize',12)
95 axis([0 .15 -1.5 1.5]);
96

97 TX=fftshift(abs(fft(tx,4096)));
98 subplot(2,1,2)
99 plot(4096*(-0.5:1/4096:0.5-1/4096),TX/4096)
100 title('Modulated Signal Spectrum','FontSize',16)
101 xlabel('Frequency [Hz]','FontSize',12)
102 ylabel('Amplitude','FontSize',12)
103 axis([100 300 0 .55])
104

105 %% ---------------------------------------------------------
106 % Double side band supressed carrier AM modulation time
107 % series and spectrum
108 %
109 % A =Carrier amplitude (supressed)
110 % tx =Modulated signal (supressed carrier)
111 % ----------------------------------------------------------
112 A=0;
113 tx=(A+m).*c;
114 figure('position',Position)
115 subplot(2,1,1)
116 plot(t,tx)
117 title('Double Side Band Suppressed Carrier (DSB-SC)','FontSize',16)
118 xlabel('Time [sec]','FontSize',12)
119 ylabel('Amplitude','FontSize',12)
120 axis([0 .15 -1.5 1.5]);
121

122 TX=fftshift(abs(fft(tx,4096)));
123 subplot(2,1,2)
124 plot(4096*(-0.5:1/4096:0.5-1/4096),TX/4096)
125 title('Modulated Signal Spectrum','FontSize',16)
150

126 xlabel('Frequency [Hz]','FontSize',12)


127 ylabel('Amplitude','FontSize',12)
128 axis([100 300 0 .55])
129

130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132

133 %% -- PAM.m ------------------------------------------------


134 % MATLAB Thesis Simulation
135 % Steven Hemple
136 %
137 % This MATLAB script will simulate pulse amplitude
138 % modulation (PAM)
139 % ----------------------------------------------------------
140 clc;
141 clear all;
142 close all;
143

144 % -- Plot Parameters ---------------------------------------


145 %
146 % Screen 0 =Size and position of plots for screen 0
147 % Screen 1 =Size and position of plots for dual monitors
148 % Screen 1 =Size and position of plots for HDMI Out
149 % (1080i)
150 % Position =Plot screen variable
151 % Plots =Toggle to turn plots on(1) or off(0)
152 % ----------------------------------------------------------
153 Screen 0=[550,10,800,650];
154 Screen 1=[1400,10,800,650];
155 Screen 2=[1360,-310,1920,1024];
156 Position=Screen 0;
157 Plots=1;
158

159 %% ---------------------------------------------------------
160 % Parameters
161 % b =Number of bits per symbol
162 % M =Number of symbols in PAM
163 % fs =Sampling frequency
164 % u =Random symbols
165 % s =Samples per bit
166 % Tb =Period of bit
167 % m =Counter
168 % fc =Carrier frequency
169 % ----------------------------------------------------------
151

170 b=2;
171 M=2b;
172 fs=8000;
173 u=zeros(1,fs);
174 s=800;
175 Tb=fs/s;
176 m=1;
177 fc=40;
178

179 %% ------------------------------------------------------------------------
180 % Constellation for PAM-M
181 %--------------------------------------------------------------------------
182 x1=-M/2:M/2;
183 x1(M/2+1)=[];
184 x1(1:M/2)=x1(1:M/2)+0.5;
185 x1(M/2+1:M)=x1(M/2+1:M)-0.5;
186 figure('position',Position)
187 h=plot(x1,zeros(1,length(x1)),'ok');
188 set(h,'MarkerSize',15);
189 set(h,'MarkerFaceColor','k');
190 mTextBox = uicontrol('style','text');
191 set(mTextBox,'String','10');
192 set(mTextBox,'Position',[635 280 30 30]);
193 set(mTextBox,'BackgroundColor','w');
194 set(mTextBox,'Fontsize',16);
195 mTextBox = uicontrol('style','text');
196 set(mTextBox,'String','11');
197 set(mTextBox,'Position',[477 280 30 30]);
198 set(mTextBox,'Fontsize',16);
199 set(mTextBox,'BackgroundColor','w');
200 mTextBox = uicontrol('style','text');
201 set(mTextBox,'String','01');
202 set(mTextBox,'Position',[323 280 30 30]);
203 set(mTextBox,'Fontsize',16);
204 set(mTextBox,'BackgroundColor','w');
205 mTextBox = uicontrol('style','text');
206 set(mTextBox,'String','00');
207 set(mTextBox,'Position',[165 280 30 30]);
208 set(mTextBox,'BackgroundColor','w');
209 set(mTextBox,'Fontsize',16);
210

211 hold on
212 plot([-M/2:M/2],zeros(1,M+1),'k')
213 plot(zeros(1,3),[-1:1],'k')
152

214 set(gca,'XTick',-1.5:2);
215 set(gca,'XTickLabel',{'-3d/2' '-d/2' 'd/2' '3d/2'})
216

217 set(gca,'YTick',[]);
218 title({'Constellation For Four Level PAM';...
219 'With Gray Coding'},'FontSize',16)
220 xlabel('Constellation Distance','FontSize',12);
221 %%-------------------------------------------------------------------------
222 % Generate random sequence of symbols
223 %--------------------------------------------------------------------------
224 for i=1:s:length(u)
225 data=randi([-M/2,M/2]);
226 while data==0 % Don't want zero as a symbol
227 data=randi([-M/2,M/2]);
228 end
229 if m>1
230 while data==u(m-1) | | data==0
231 data=randi([-M/2,M/2]);
232 end
233 end
234 u(m:m+s-1)=data;
235 m=m+s; % Skip s samples (samples per bit)
236 end
237

238 figure('position',Position)
239 subplot(2,1,1)
240 plot((0:length(u)-1)/800,u,'r')
241 grid on
242 set(gca,'XTick',0:10);
243 set(gca,'XTickLabel',...
244 {'0' 'T' '2T' '3T' '4T' '5T' '6T' '7T' '8T' '9T' '10T'})
245 set(gca,'YTick',-2:2);
246 ylabel('Signal Amplitude','FontSize',12);
247 xlabel('Symbol Period','FontSize',12);
248 axis([-0.25 10.25 -M/2-0.5 M/2+0.5]);
249 title({'Baseband PAM Signal';...
250 'With Rectangular Pulse Period T'},'FontSize',16)
251 subplot(2,1,2)
252 c=cos(2*pi*fc.*1/fs*(0:length(u)-1));
253 x=u.*c;
254 plot((0:length(u)-1)/800,x)
255 hold on
256 plot((0:length(u)-1)/800,u,'--r')
257 set(gca,'XTick',[0:10]);
153

258 set(gca,'XTickLabel',...
259 {'0' 'T' '2T' '3T' '4T' '5T' '6T' '7T' '8T' '9T' '10T'})
260 set(gca,'YTick',-2:2);
261 ylabel('Signal Amplitude','FontSize',12)
262 axis([-0.25 10.25 -M/2-0.5 M/2+0.5]);
263 grid on
264 title({'Bandpass PAM Signal With Rectangular Pulse...
265 Period T And';'Carrier Frequency 4 Cycles Per...
266 Period'},'FontSize',16)
267 xlabel('Symbol Period','FontSize',12);
268

269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271

272 %% -- PSK.m ------------------------------------------------


273 % MATLAB Thesis Simulation
274 % Steven Hemple
275 %
276 % This MATLAB script will geberate constellations for binary
277 % phase shift keying (BPSK) and phase shift keying using Gray
278 % coding.
279 % ----------------------------------------------------------
280 clc;
281 clear all;
282 close all;
283

284 % -- Plot Parameters ---------------------------------------


285 %
286 % Screen 0 =Size and position of plots for screen 0
287 % Screen 1 =Size and position of plots for dual monitors
288 % Screen 1 =Size and position of plots for HDMI Out
289 % (1080i)
290 % Position =Plot screen variable
291 % Plots =Toggle to turn plots on(1) or off(0)
292 % ----------------------------------------------------------
293 Screen 0=[550,10,800,650];
294 Screen 1=[1400,10,800,650];
295 Screen 2=[1360,-310,1920,1024];
296 Position=Screen 0;
297 Plots=1;
298

299 %% ---------------------------------------------------------
300 % Parameters
301 %
154

302 % e p =Average energy


303 % M =Number of symbols in constellation
304 % m =Counter
305 % x,y =Coordinates for constellation
306 %
307 %
308 % ----------------------------------------------------------
309 e p=2;
310

311 %% ---------------------------------------------------------
312 % BPSK
313 % ----------------------------------------------------------
314 M=2;
315 m=1:M;
316 x=sqrt(e p/2)*cos(2*pi/M.*(m-1));
317 y=sqrt(e p/2)*sin(2*pi/M.*(m-1));
318 t=(0:256)*2*pi/256;
319

320 figure('position',Position)
321 plot( cos(t), sin(t),'r');
322 axis('square')
323 hold on
324 plot(x,y,'o','MarkerFaceColor','b','MarkerSize',12)
325 mTextBox = uicontrol('style','text')
326 set(mTextBox,'String','0')
327 set(mTextBox,'Position',[240 340 30 15])
328 mTextBox = uicontrol('style','text')
329 set(mTextBox,'String','1')
330 set(mTextBox,'Position',[560 340 30 15])
331 set(gca,'XTick',[]);
332 set(gca,'YTick',[]);
333 axis([-2 2 -2 2])
334

335 line([0 0], [-2 2],'color','k')


336 line([-2 2], [0 0],'color','k')
337 title({'Signal Constellation for BPSK';...
338 'With Gray Encoding'},'FontSize',16);
339

340

341 %% ---------------------------------------------------------
342 % QPSK
343 % ----------------------------------------------------------
344 M=4;
345 m=1:M;
155

346 x=sqrt(e p/2)*cos(pi.*(2*m-1)/M);


347 y=sqrt(e p/2)*sin(pi.*(2*m-1)/M);
348

349 figure('position',Position)
350 t=(0:256)*2*pi/256;
351 plot( cos(t), sin(t),'r');
352 axis('square')
353 hold on
354 plot(x,y,'o','MarkerFaceColor','b','MarkerSize',12)
355 mTextBox = uicontrol('style','text')
356 set(mTextBox,'String','00')
357 set(mTextBox,'Position',[280 230 30 15])
358 mTextBox = uicontrol('style','text')
359 set(mTextBox,'String','11')
360 set(mTextBox,'Position',[520 420 30 15])
361 mTextBox = uicontrol('style','text')
362 set(mTextBox,'String','01')
363 set(mTextBox,'Position',[280 420 30 15])
364 mTextBox = uicontrol('style','text')
365 set(mTextBox,'String','10')
366 set(mTextBox,'Position',[520 230 30 15])
367 axis([-2 2 -2 2])
368 set(gca,'XTick',[]);
369 set(gca,'YTick',[]);
370 line([0 0], [-2 2],'color','k')
371 line([-2 2], [0 0],'color','k')
372 title({'Signal Constellation for QPSK';...
373 'With Gray Encoding'},'FontSize',16);
374

375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377

378 %% -- QAM.m ------------------------------------------------


379 % MATLAB Thesis Simulation
380 % Steven Hemple
381 %
382 % This script will generate the constellation for
383 % rectangular M-QAM and generate the Gray coding scheme. M
384 % must be of the form M=n2 where n is an even integer.
385 % ----------------------------------------------------------
386 close all;
387 clear all;
388 clc;
389 Screen 0=[550,10,800,650];
156

390 Screen 1=[1400,10,800,650];


391 Screen 2=[1360,-310,1920,1024];
392 Position=Screen 0;
393 Plots=1;
394

395 %% ---------------------------------------------------------
396 % Parameters
397 %
398 % M =Number of symbols in constellation
399 % rc =Nummber of rows and columns in constellation
400 % b =Number of bits per symbol
401 % snr =Signal to noise ratio
402 % ----------------------------------------------------------
403 M=42;
404 rc=sqrt(M);
405 b=log2(M);
406 snr=8;
407

408 %% ---------------------------------------------------------
409 % Generate the row and column locations for the
410 % constellation
411 % ----------------------------------------------------------
412 x=[-rc+1:2:rc-1]; % Compute x-coords of the constellation
413 y=[-rc+1:2:rc-1]; % Compute y-coords of the constellation
414 x cor=x;
415 y cor=y;
416

417 %% ---------------------------------------------------------
418 % Generate the row vectors of the x and y coordinates of
419 % each symbol
420 %
421 % Create a length M vector of x and y coordinates for all
422 % constellation points
423 % ----------------------------------------------------------
424 for i=1:rc-1
425 x cor=[x cor; x];
426 y cor=[y cor; y];
427 end
428 X=reshape(x cor',1,M);
429 Y=reshape(y cor,1,M);
430

431 %% ---------------------------------------------------------
432 % Plot the constellation for M-QAM
433 % ----------------------------------------------------------
157

434 figure('name',...
435 'Thesis OFDM Simulation- Channel Transfer Function',...
436 'position',Position)
437 h=plot(X,Y,'ok');
438 axis([-rc-1 rc+1 -rc-1 rc+1]);
439 title({['Constellation Diagram For Rectangular ',...
440 num2str(M), '-QAM']},'FontSize',16);
441 xlabel('In-Phase','FontSize',12)
442 ylabel('Quadrature','FontSize',12)
443 set(h,'MarkerSize',15);
444 set(h,'MarkerFaceColor','k');
445 r=[225 350 475 600];
446 c=[185 300 415 530];
447 s=[2 6 14 10;3 7 15 11;1 5 13 9;0 4 12 8];
448

449 hold on
450 plot([0 0],[-5 5],'k')
451 plot([-5 5],[0 0],'k')
452 plot([-2 -2],[-5 5],'-.k')
453 plot([2 2],[-5 5],'-.k')
454 plot([-5 5],[-2 -2],'-.k')
455 plot([-5 5],[2 2],'-.k')
456 axis([-4 4 -4 4])
457 axis('square')
458 set(gca,'XTick',[-3 -1 0 1 3],'YTick',[-3 -1 0 1 3])
459 set(gca,'XTickLabel',{'-3/2d','-d/2', '0','d/2','3/2d'})
460 set(gca,'YTickLabel',{'-3/2d','-d/2', '0','d/2','3/2d'})
461 arrow([-3 1],[-1 1],'width',2)
462 arrow([-1 1],[-3 1],'width',2)
463 mTextBox=uicontrol('style','text');
464 set(mTextBox,'String','d');
465 set(mTextBox,'FontSize',16);
466 set(mTextBox,'Position',[252 415 15 25]);
467 set(mTextBox,'BackgroundColor',[1 1 1]);
468 arrow([-1 1],[-1 3],'width',2)
469 arrow([-1 3],[-1 1],'width',2)
470 mTextBox=uicontrol('style','text');
471 set(mTextBox,'String','d');
472 set(mTextBox,'FontSize',16);
473 set(mTextBox,'Position',[310 456 15 25]);
474 set(mTextBox,'BackgroundColor',[1 1 1]);
475

476 %% ---------------------------------------------------------
477 % Gray codingfor M-QAM
158

478 % ----------------------------------------------------------
479 figure('position',Position)
480 h=plot(X,Y,'ok');
481 axis([-rc-1 rc+1 -rc-1 rc+1]);
482 title({['Gray Coding For Rectangular ',...
483 num2str(M), '-QAM']},'FontSize',16);
484 xlabel('In-Phase','FontSize',12)
485 ylabel('Quadrature','FontSize',12)
486 set(h,'MarkerSize',15);
487 set(h,'MarkerFaceColor','k');
488 r=[90 225 350 475];
489 c=[185 320 455 585];
490 s=[2 6 14 10;3 7 15 11;1 5 13 9;0 4 12 8];
491 for i=1:length(r)
492 for ii=1:length(c)
493 mTextBox = uicontrol('style','text');
494 set(mTextBox,'String',dec2bin(s(ii,i),4));
495 set(mTextBox,'Position',[c(i) r(ii) 60 30]);
496 set(mTextBox,'BackgroundColor','w');
497 set(mTextBox,'Fontsize',18);
498 end
499 end
500 hold on
501 plot([0 0],[-5 5],'k')
502 plot([-5 5],[0 0],'k')
503 plot([-2 -2],[-5 5],'-.k')
504 plot([2 2],[-5 5],'-.k')
505 plot([-5 5],[-2 -2],'-.k')
506 plot([-5 5],[2 2],'-.k')
507 axis([-4 4 -4 4])
508 axis('square')
159

APPENDIX C
MATLAB CODE FOR OFDM
160

MATLAB CODE FOR OFDM

1 %% -- FFT Modulation.m -------------------------------------


2 % MATLAB Thesis Simulation
3 % Steven Hemple
4 %
5 % This MATLAB simulation demonstrates the use of the
6 % IFFT/FFT for OFDM modulation.
7 % ----------------------------------------------------------
8 clear all;
9 close all;
10 clc;
11

12 % -- Plot Parameters ---------------------------------------


13 %
14 % Screen 0 =Size and position of plots for screen 0
15 % Screen 1 =Size and position of plots for dual monitors
16 % Screen 1 =Size and position of plots for HDMI Out
17 % (1080i)
18 % Position =Plot screen variable
19 % Plots =Toggle to turn plots on(1) or off(0)
20 % ----------------------------------------------------------
21 Screen 0=[550,10,800,650];
22 Screen 1=[1400,10,800,650];
23 Screen 2=[1360,-310,1920,1024];
24 Position=Screen 0;
25 Plots=1;
26

27 %% -- Parameters -------------------------------------------
28 %
29 % N =Transform length
30 % x =Input to IFFT (in serial to parallel form)
31 % g =Number of bin outputs to graph
32 % cp =Number of samples in cyclic prefix
33 % ----------------------------------------------------------
34 N=26;
35 g=9;
36 cp=floor(0.25*N);
37 x=diag(ones(1,N));
161

38

39 %% -- OFDM Modulation with IFFT ----------------------------


40 Y=ifft(x);
41 clear x;
42

43 %% -- Plot IFFT Output for various bins --------------------


44 figure('name',...
45 'Thesis OFDM Simulation- Real Part of IFFT Output',...
46 'position',Position)
47 for nn=1:g
48 subplot(sqrt(g),sqrt(g),nn);
49 plot(0:1/N:1-1/N,N*real(Y(:,nn)),'r');
50 title({[num2str(nn-1),' Cycles per Interval']});
51 axis([0 1 -1.1 1.1]);
52 axis('square');
53 set(gca,'YTick',[-1 0 1]);
54 end
55 figure(1)
56 [ax4,h3]=suplabel('Real Part of 64-Point IFFT Output For...
57 Frequency Bins 0-8','t');
58 set(h3,'FontSize',16);
59

60 figure('name',...
61 'Thesis OFDM Simulation- Imaginary Part of IFFT Output',...
62 'position',Position)
63 for nn=1:g
64 subplot(sqrt(g),sqrt(g),nn);
65 plot(0:1/N:1-1/N,N*imag(Y(:,nn)));
66 title({[num2str(nn-1),' Cycles per Interval']});
67 axis([0 1 -1.1 1.1]);
68 axis('square');
69 set(gca,'YTick',[-1 0 1]);
70 end
71 figure(2)
72 [ax4,h3]=suplabel('Imaginary Part of 64-Point IFFT Output...
73 For Frequency Bins 0-8','t');
74 set(h3,'FontSize',16);
75

76 figure('name',...
77 'Thesis OFDM Simulation- Real Part of IFFT Output',...
78 'position',Position)
79

80 stem(0:N-1,N*real(Y(:,4)),'r','LineWidth',2)
81 hold on
162

82 plot([0 0],[-.05 .05],'k','LineWidth',3);


83 plot([63 63],[-.05 .05],'k','LineWidth',3);
84 plot([-1 64],[0 0],'k','LineWidth',3);
85 plot(0:N-1,N*real(Y(:,4)),'-.k','LineWidth',2)
86 hold off
87 axis([-1 N -1.1 1.1])
88 set(gca,'YTick',[]);
89 set(gca,'XTick',[])
90 mTextBox=uicontrol('style','text');
91 set(mTextBox,'String','0');
92 set(mTextBox,'FontSize',14);
93 set(mTextBox,'Position',[100 355 15 20]);
94 set(mTextBox,'BackgroundColor','w');
95 mTextBox=uicontrol('style','text');
96 set(mTextBox,'String','63');
97 set(mTextBox,'FontSize',14);
98 set(mTextBox,'Position',[655 360 23 20]);
99 set(mTextBox,'BackgroundColor','w');
100

101 figure('name',...
102 'Thesis OFDM Simulation- Imaginary Part of IFFT Output'...
103 ,'position',Position)
104 stem(0:N-1,N*imag(Y(:,4)),'LineWidth',2)
105 hold on
106 plot([0 0],[-.05 0],'k','LineWidth',3);
107 plot([63 63],[0 .05],'k','LineWidth',3);
108 plot([-1 64],[0 0],'k','LineWidth',3);
109 plot(0:N-1,N*imag(Y(:,4)),'-.k','LineWidth',2)
110 hold off
111 axis([-1 N -1.1 1.1])
112 set(gca,'YTick',[]);
113 set(gca,'XTick',[])
114 mTextBox=uicontrol('style','text');
115 set(mTextBox,'String','0');
116 set(mTextBox,'FontSize',14);
117 set(mTextBox,'Position',[100 355 15 20]);
118 set(mTextBox,'BackgroundColor','w');
119 mTextBox=uicontrol('style','text');
120 set(mTextBox,'String','63');
121 set(mTextBox,'FontSize',14);
122 set(mTextBox,'Position',[655 360 23 20]);
123 set(mTextBox,'BackgroundColor','w');
124 %% -- OFDM Demodulation ------------------------------------
125 x=fft(Y(:,4));
163

126 figure('name',...
127 'Thesis OFDM Simulation- Real Part of FFT Output'...
128 ,'position',Position)
129 stem(real(x'),'r')
130 set(gca,'XTick',[1 4 54 64])
131 set(gca,'XTickLabel',{'0','3','k','63'})
132 axis([0 65 -0.05 2])
133 set(gca,'cameraupvector',[-1 0 0]);
134 set(gca,'YTick',[]);
135

136 figure('name',...
137 'Thesis OFDM Simulation- Imaginary Part of FFT Output'...
138 ,'position',[685,85,750,740])
139 stem(imag(x'))
140 set(gca,'XTick',[1 4 54 64])
141 set(gca,'XTickLabel',{'0','3','k','63'})
142 axis([0 65 -0.05 2])
143 set(gca,'cameraupvector',[-1 0 0]);
144 set(gca,'YTick',[]);
145

146

147 figure('name','Thesis OFDM Simulation- OFDM Spectrum'...


148 ,'position',Position)
149 f=-0.5:0.001:0.5-0.001;
150 hold on
151 y=0;
152 for nn=0.05:0.05:0.25
153 plot(f,sinc((f-nn)*20).*exp(1j*2*pi*(f)*.01))
154 plot(f,sinc((f+nn)*20).*exp(1j*2*pi*(f)*.01))
155 plot([nn nn],[0 1],'-.k')
156 plot([-nn -nn],[0 1],'-.k')
157 y=y+sinc((f-nn)*20)+sinc((f+nn)*20);
158 end
159

160

161 %% -- Cyclic Prefix ----------------------------------------


162 Y cp=[Y(4,N-cp+1:N) Y(4,:)];
163 figure('name','Thesis OFDM Simulation- Cyclic Prefix'...
164 ,'position',Position)
165

166 plot(0,0,'w')
167 hold on
168 axis([-0.1 79.1 -1.2 1.2])
169 rectangle('Position',[N, -1.2, cp-1, 2.4],...
164

170 'FaceColor',[0.9 0.9 0.9])


171 rectangle('Position',[0, -1.2, cp-1, 2.4],...
172 'FaceColor',[0.9 0.9 0.9])
173 plot(0:N+cp-1,N*real(Y cp),'r')
174

175 arrow([N 0],[cp-1 0],'Width',3)


176 arrow([cp-1 1.1],[N+cp-1 1.1])
177 arrow([N+cp-1 1.1],[cp-1 1.1])
178 arrow([0 1.1],[cp-1.1 1.1])
179 arrow([cp-1.1 1.1],[0 1.1])
180 plot([cp-1 cp-1],[-1 1.2],'-.k')
181 plot([N+cp-1 N+cp-1],[-1 1],'-.k')
182 set(gca,'XTick',[])
183 set(gca,'YTick',[-1 0 1])
184 axis([-0.1 79.1 -1.2 1.2])
185 title('Real Part of 25% Cyclically Extnded OFDM Symbol',...
186 'FontSize',16)
187 mTextBox=uicontrol('style','text');
188 set(mTextBox,'String','Prefix');
189 set(mTextBox,'FontSize',14);
190 set(mTextBox,'Position',[125 650 60 20]);
191 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9]);
192 mTextBox=uicontrol('style','text');
193 set(mTextBox,'String','Symbol');
194 set(mTextBox,'FontSize',14);
195 set(mTextBox,'Position',[400 650 65 20]);
196 set(mTextBox,'BackgroundColor','w');
197

198 figure('name','Thesis OFDM Simulation- Cyclic Prefix'...


199 ,'position',Position)
200

201 plot(0,0,'w')
202 hold on
203 axis([-0.1 79.1 -1.2 1.2])
204 rectangle('Position',[N, -1.2, cp-1, 2.4],...
205 'FaceColor',[0.9 0.9 0.9])
206 rectangle('Position',[0, -1.2, cp-1, 2.4],...
207 'FaceColor',[0.9 0.9 0.9])
208 plot(0:N+cp-1,64*imag(Y cp))
209 axis([-0.1 79.1 -1.2 1.2])
210 arrow([N 0],[cp-1 0],'Width',3)
211 arrow([cp-1 1.1],[N+cp-1 1.1])
212 arrow([N+cp-1 1.1],[cp-1 1.1])
213 arrow([0 1.1],[cp-1.1 1.1])
165

214 arrow([cp-1.1 1.1],[0 1.1])


215 hold on
216 plot([cp-1 cp-1],[-1 1],'-.k')
217 plot([N+cp-1 N+cp-1],[-1 1],'-.k')
218 set(gca,'XTick',[])
219 set(gca,'YTick',[-1 0 1])
220 title(...
221 'Imaginary Part of 25% Cyclically Extended OFDM Symbol'...
222 ,'FontSize',16)
223 mTextBox=uicontrol('style','text');
224 set(mTextBox,'String','Prefix');
225 set(mTextBox,'FontSize',14);
226 set(mTextBox,'Position',[125 650 60 20]);
227 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9]);
228 mTextBox=uicontrol('style','text');
229 set(mTextBox,'String','Symbol');
230 set(mTextBox,'FontSize',14);
231 set(mTextBox,'Position',[400 650 65 20]);
232 set(mTextBox,'BackgroundColor','w');
233

234

235

236 figure('name','Thesis OFDM Simulation- Cyclic Prefix'...


237 ,'position',Position)
238

239 plot(0,0,'w')
240 hold on
241 axis([-0.1 79.1 -1.2 1.2])
242 rectangle('Position',[N, -1.2, cp-1, 2.4],...
243 'FaceColor',[0.9 0.9 0.9])
244 rectangle('Position',[0, -1.2, cp-1, 2.4],...
245 'FaceColor',[0.9 0.9 0.9])
246 stem(0:N+cp-1,N*real(Y cp),'r')
247

248 arrow([N 0],[cp-1 0],'Width',3)


249 arrow([cp-1 1.1],[N+cp-1 1.1])
250 arrow([N+cp-1 1.1],[cp-1 1.1])
251 arrow([0 1.1],[cp-1.1 1.1])
252 arrow([cp-1.1 1.1],[0 1.1])
253 plot([cp-1 cp-1],[-1 1.2],'-.k')
254 plot([N+cp-1 N+cp-1],[-1 1],'-.k')
255 set(gca,'XTick',[0 cp-1 N N+cp-1])
256 set(gca,'YTick',[-1 0 1])
257 axis([-0.1 79.1 -1.2 1.2])
166

258 title('Real Part of 25% Cyclically Extnded OFDM Symbol',...


259 'FontSize',16)
260 mTextBox=uicontrol('style','text');
261 set(mTextBox,'String','Prefix');
262 set(mTextBox,'FontSize',14);
263 set(mTextBox,'Position',[125 650 60 20]);
264 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9]);
265 mTextBox=uicontrol('style','text');
266 set(mTextBox,'String','Symbol');
267 set(mTextBox,'FontSize',14);
268 set(mTextBox,'Position',[400 650 65 20]);
269 set(mTextBox,'BackgroundColor','w');
270

271 figure('name','Thesis OFDM Simulation- Cyclic Prefix'...


272 ,'position',Position)
273 plot(0,0,'w')
274 hold on
275 axis([-0.1 79.1 -1.2 1.2])
276 rectangle('Position',[N, -1.2, cp-1, 2.4],...
277 'FaceColor',[0.9 0.9 0.9])
278 rectangle('Position',[0, -1.2, cp-1, 2.4],...
279 'FaceColor',[0.9 0.9 0.9])
280 stem(0:N+cp-1,64*imag(Y cp))
281 axis([-0.1 79.1 -1.2 1.2])
282 arrow([N 0],[cp-1 0],'Width',3)
283 arrow([cp-1 1.1],[N+cp-1 1.1])
284 arrow([N+cp-1 1.1],[cp-1 1.1])
285 arrow([0 1.1],[cp-1.1 1.1])
286 arrow([cp-1.1 1.1],[0 1.1])
287 hold on
288 plot([cp-1 cp-1],[-1 1],'-.k')
289 plot([N+cp-1 N+cp-1],[-1 1],'-.k')
290 set(gca,'XTick',[0 cp-1 N N+cp-1])
291 set(gca,'YTick',[-1 0 1])
292 title(...
293 'Imaginary Part of 25% Cyclically Extended OFDM Symbol'...
294 ,'FontSize',16)
295 mTextBox=uicontrol('style','text');
296 set(mTextBox,'String','Prefix');
297 set(mTextBox,'FontSize',14);
298 set(mTextBox,'Position',[125 650 60 20]);
299 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9]);
300 mTextBox=uicontrol('style','text');
301 set(mTextBox,'String','Symbol');
167

302 set(mTextBox,'FontSize',14);
303 set(mTextBox,'Position',[400 650 65 20]);
304 set(mTextBox,'BackgroundColor','w');
168

APPENDIX D
MATLAB CODE FOR SYNCHRONIZATION
169

MATLAB CODE FOR SYNCHRONIZATION

1 %% -- Frequency Offset -------------------------------------


2 % Thesis Simulation
3 % Steven Hemple
4 % 8 April 2011
5 %
6 % This Matlab script will simulate a frequency offset in
7 % OFDM.
8 % ----------------------------------------------------------
9 close all;
10 clear all;
11 clc;
12

13 % -- Scipt Parameters --------------------------------------


14 %
15 % Screen 0 =Size and position of plots for screen 0
16 % Screen 1 =Size and position of plots for screen 1
17 % Screen 1 =Size and position of plots for dual monitor
18 % Position =Plot screen variable
19 % Plots =Toggle to turn plots on(1) or off(0)
20 % ----------------------------------------------------------
21 Screen 0=[550,10,800,650];
22 Screen 1=[1400,10,800,750];
23 Screen 2=[];
24 Position=Screen 0;
25 Plots=1;
26

27 %% -- Parameters -------------------------------------------
28 %
29 %
30 % ----------------------------------------------------------
31 frames=120;
32 Nfft=64;
33 bins=52;
34 cp=16;
35 M=16;
36 num=log2(M);
37 x4=[];
170

38

39 Epsilon=0.05;
40

41 SNR=20;
42 Theta=0.0;
43 x3save=[];
44 x4 save=[];
45

46 %% -- OFDM Time Series -------------------------------------


47 %
48 % x1 =Random 16-QAM data
49 % x2 =Input to IFFT
50 % x3 =Output of IFFT
51 % x4 =Time series output of modulator
52 % ----------------------------------------------------------
53 for nn=1:frames
54 x1=(floor(num*rand(1,bins+1))-(num-1)/2)/((num-1)/2)+...
55 1j*(floor(num*rand(1,bins+1))-(num-1)/2)/((num-1)/2);
56 x1(27)=0;
57 x2=zeros(1,Nfft);
58 x2((-26:26)+Nfft/2+1)=x1;
59 x2=fftshift(x2);
60 x3=4*ifft(x2);
61 x3save(nn,:)=[x3(end-cp+1:end) x3];
62 x4(nn,:)=x3save(nn,:).*exp(1j*2*pi*((nn-1)*(cp+Nfft)...
63 :nn*(cp+Nfft)-1)/Nfft*Epsilon).*exp(1j*Theta);
64 x5(nn,:)=x3save(nn,:).*exp(1j*2*pi*(0:Nfft+cp-1)/...
65 Nfft*Epsilon).*exp(1j*Theta);
66 end
67 x4=awgn(x4,SNR,'measured');
68 x5=awgn(x5,SNR,'measured');
69

70 %% -- Demodulate With Offset -------------------------------


71 %
72 % y1 =Time series with frequency offset and noise
73 % reg1 =Input to FFT
74 % reg2 =Output of FFT
75 % reg3 =Used frequency bins
76 % reg4 =Demodulated symbols
77 % ----------------------------------------------------------
78 for nn=1:frames
79 reg1=x4(nn,cp+1:cp+Nfft);
80 reg1a=x5(nn,cp+1:cp+Nfft);
81 reg2=fftshift(fft(reg1))/4;
171

82 reg2a=fftshift(fft(reg1a))/4;
83 reg3=[reg2((-26:-1)+Nfft/2+1) reg2((1:26)+Nfft/2+1)];
84 reg3a=[reg2a((-26:-1)+Nfft/2+1) reg2a((1:26)+Nfft/2+1)];
85 reg4(nn,:)=reg2;
86 reg4a(nn,:)=reg2a;
87 reg5(nn,:)=reg3;
88 reg5a(nn,:)=reg3a;
89 end
90 figure('name','Thesis Frequency Offset Simulation- ...
91 Constellation Diagram With Offset','position',Position)
92 plot(reg5a,'ro')
93 grid on
94 title({['Constellation of ',num2str(M),...
95 '-QAM with Normalized CFO of \epsilon=',...
96 num2str(Epsilon)];['for ',num2str(frames),...
97 ' Simulations of Transmitting One Frame']},...
98 'FontSize',16)
99 axis([-1.5 1.5 -1.5 1.5])
100 axis('square')
101 hold on
102 plot(sqrt(2)*1/3*exp(1j*2*pi*(0:0.01:10)),'k')
103 plot(sqrt(10)/3*exp(1j*2*pi*(0:0.01:10)),'k')
104 plot(sqrt(2)*exp(1j*2*pi*(0:0.01:10)),'k')
105

106 figure('name','Thesis Frequency Offset Simulation-...


107 Constellation Diagram With Offset','position',Position)
108 plot(reg5,'ro')
109 grid on
110 title({['Constellation of ',num2str(M),...
111 '-QAM with Normalized CFO of \epsilon=',...
112 num2str(Epsilon)]},'FontSize',16)
113 axis([-1.5 1.5 -1.5 1.5])
114 axis('square')
115 hold on
116 plot(sqrt(2)*1/3*exp(1j*2*pi*(0:0.01:10)),'k')
117 plot(sqrt(10)/3*exp(1j*2*pi*(0:0.01:10)),'k')
118 plot(sqrt(2)*exp(1j*2*pi*(0:0.01:10)),'k')
119

120

121 figure('name','Thesis Frequency Offset Simulation-...


122 Spectrum With Offset','position',Position)
123

124 subplot(2,1,1)
125 plot(-32:31,real(reg4),'rx')
172

126 grid on
127 xlabel('Bin','Fontsize',12)
128 title('Real Part','FontSize',12)
129

130 subplot(2,1,2)
131 plot(-32:31,imag(reg4),'bx')
132 grid on
133 xlabel('Bin','Fontsize',12)
134 title('Imaginary Part','FontSize',12)
135

136 [ax,h3]=suplabel('Spectrum of 16-QAM with Normalized CFO...


137 \epsilon=0.05','t');
138 set(h3,'FontSize',16)
139

140 %% -- ICI Investigation ------------------------------------


141 x=0:63;
142 ICI1=exp(1j*pi*(x+Epsilon)*(1+1/Nfft))/Nfft.*...
143 ((sin(pi*(x+Epsilon)))./(sin(pi*(x+Epsilon)/Nfft)));
144 ICI2=exp(1j*pi*(x+Epsilon/2)*(1+1/Nfft))/Nfft.*...
145 ((sin(pi*(x+Epsilon/2)))./(sin(pi*(x+Epsilon/2)/Nfft)));
146 ICI3=exp(1j*pi*(x+Epsilon*2)*(1+1/Nfft))/Nfft.*...
147 ((sin(pi*(x+Epsilon*2)))./(sin(pi*(x+Epsilon*2)/Nfft)));
148 ICI4=exp(1j*pi*(x+Epsilon*10)*(1+1/Nfft))/Nfft.*...
149 ((sin(pi*(x+Epsilon*10)))./(sin(pi*(x+Epsilon*10)/Nfft)));
150

151 figure('name','Thesis Frequency Offset Simulation- ICI ...


152 Coefficients','position',Position)
153 plot(x,20*log10(abs(ICI4)),'gp')
154 hold on
155 plot(x,20*log10(abs(ICI3)),'k*')
156 plot(x,20*log10(abs(ICI1)),'ro')
157 plot(x,20*log10(abs(ICI2)),'x')
158 axis([0 64 -60 5])
159 grid on
160 title('Interchannel Interference Coefficients',...
161 'FontSize',16)
162 xlabel('Subcarrier Index','FontSize',12)
163 ylabel('Power [dB]','FontSize',12)
164 legend({['\epsilon=',num2str(Epsilon*10)];...
165 ['\epsilon=',num2str(Epsilon*2)];...
166 ['\epsilon=',num2str(Epsilon)];...
167 ['\epsilon=',num2str(Epsilon/2)]},...
168 'location','Best','FontSize',12)
169
173

170 Epsilon=0:0.01:0.5;
171 x=1:63;
172 ICI Power=[];
173 for nn=Epsilon
174 ICI Power=[ICI Power;sum(abs(exp(1j*pi*(x+nn)*...
175 (1+1/Nfft))/Nfft.*((sin(pi*(x+nn)))./...
176 (sin(pi*(x+nn)/Nfft)))).2)];
177 end
178 figure('name','Thesis Frequency Offset Simulation-...
179 ICI Coefficients','position',Position)
180 plot(Epsilon,10*log10(ICI Power))
181 hold on
182 plot(Epsilon,10*log10(((pi*Epsilon).2)/3),'-xr')
183 axis([0 0.5 -35 0])
184 grid on
185 xlabel('Normalized Carrier Frequency Offset','FontSize',12);
186 ylabel('Power [dB]','FontSize',12);
187 title('ICI Power Resulting From Frequency Offset',...
188 'FontSize',16);
189 legend('Theoretical','Approximation','location','northwest')
190

191 k=1:Nfft-1;
192 den=[];
193 num=[];
194 t=0.00001:0.001:0.5;
195 for nn=t
196 num=[num abs(exp(1j*pi*(nn)*(1+1/Nfft))/Nfft.*...
197 ((sin(pi*(nn)))./(sin(pi*(nn)/Nfft)))).2];
198 den=[den sum(abs((exp(1j*pi*(k+nn)*(1+1/Nfft))/Nfft)...
199 .*(sin(pi*(k+nn))./sin(pi*(k+nn)/Nfft))).2)];
200 end
201

202 figure('name','Thesis Frequency Offset Simulation- ...


203 Carrier to Interference Power Ratio (CIR)','position',Position)
204 plot(t,10*log10(num./den))
205 xlabel('Normalized Carrier Frequency Offset \epsilon',...
206 'FontSize',12)
207 ylabel('CIR [dB]','FontSize',12)
208 title('Carrier to Interference Power Ratio (CIR)',...
209 'FontSize',16)
210 grid on
211 axis([-0.01 0.5 -5 100])
212 hold on
213
174

214

215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
217

218 %% -- SampleClock.m ----------------------------------------


219 % MATLAB Thesis Simulation
220 % Steven Hemple
221 % 9 April 2011
222 %
223 % This MATLAB simulation shows the effects of sampling clock
224 % offset.
225 % ----------------------------------------------------------
226 clear all;
227 close all;
228 clc;
229

230 % -- Scipt Parameters --------------------------------------


231 %
232 % Screen 0 =Size and position of plots for screen 0
233 % Screen 1 =Size and position of plots for screen 1
234 % Screen 1 =Size and position of plots for dual monitor
235 % Position =Plot screen variable
236 % Plots =Toggle to turn plots on(1) or off(0)
237 % ----------------------------------------------------------
238 Screen 0=[550,10,800,650];
239 Screen 1=[1400,10,800,650];
240 Screen 2=[];
241 Position=Screen 0;
242 Plots=1;
243

244 %% -- Parameters -------------------------------------------


245 Nsym=64;
246 symSpace=1;
247 Nfft=64;
248 numSims=100;
249 fs=100;
250 epsilon=0.01;
251 sampOffset=round((1+epsilon)*fs);
252 iciPower=zeros(1,Nfft);
253 sigPower=zeros(1,Nfft);
254 M=4;
255 num=log2(M);
256 k=0:Nfft-1;
257 atten=1/Nfft*((1-exp(1j*2*pi*k*epsilon))./...
175

258 (1-exp(1j*2*pi*k*epsilon/Nfft)));
259

260 atten(1)=1;
261 figure('name','Thesis Sample Clock Offset Simulation-...
262 Spectrum','position',Position)
263 hold on
264 for t=1:numSims
265 x1=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
266 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
267

268

269 % Demodulate
270 y=ifft(x1);
271 y1=fs*ifft(x1,Nfft*fs);
272

273 y1=y1(1:sampOffset:end);
274 y1=[y1 zeros(1,Nfft-length(y1))];
275 Y=fft(y,Nfft);
276 Y1=fft(y1,Nfft);
277

278 ici=Y1-x1.*atten;
279 iciPower=iciPower+abs(ici/sqrt(2)).2;
280 sigPower=sigPower+abs(x1.*atten).2;
281

282

283

284 subplot(3,1,1)
285 plot(0:Nfft-1,real(Y),'rx')
286 grid on
287 hold on
288 subplot(3,1,2)
289 plot(0:Nfft-1,real(Y.*atten),'rx')
290 hold on
291 grid on
292 subplot(3,1,3)
293 plot(0:Nfft-1,real(Y1),'rx')
294 hold on
295 grid on
296 end
297

298 %% -- ICI Investigation ------------------------------------


299 figure(1)
300 subplot(3,1,1)
301 title('No Sample Clock Offset','FontSize',12)
176

302 axis([0 64 -1.5 1.5])


303

304 subplot(3,1,2)
305 title({['Sample Clock Offset of ',num2str(epsilon*100),...
306 '% With No ICI']},'FontSize',12)
307 axis([0 64 -1.5 1.5])
308

309 subplot(3,1,3)
310 xlabel('Sub-carrier Index','FontSize',12)
311 title({['Sample Clock Offset of ',num2str(epsilon*100),...
312 '% With ICI']},'FontSize',12)
313 axis([0 64 -3 3])
314 [ax,h3]=suplabel('Effects of Sample Clock Offset on Spectrum','t');
315 set(h3,'FontSize',16)
316

317

318 figure('name','Thesis Sampling Clock Offset Simulation- ...


319 Constellation Diagram','position',Position)
320 plot(1:64,real(y(1:64)),'-o')
321 hold on
322 plot(1:64,real(y1(1:64)),'-*r')
323 grid on
324 legend('No Offset','Resampled With Offset')
325 xlabel('Sample','FontSize',12)
326 ylabel('Magnitude','FontSize',12)
327 title('Time Series with 1% Sample Clock Offset','FontSize',16)
328

329 figure('name','Thesis Sampling Clock Offset Simulation- ...


330 Constellation Diagram','position',Position)
331 subplot(2,2,1)
332 plot(Y,'bo')
333 xlabel('In-Phase','FontSize',12)
334 ylabel('Quadrature','FontSize',12)
335 title('Constellation With No Offset','FontSize',12)
336 grid on
337 axis('square')
338 axis([-2 2 -2 2])
339

340 subplot(2,2,2)
341 plot(Y.*atten,'rx')
342 hold on
343 plot(Y,'bo')
344 xlabel('In-Phase','FontSize',12)
345 ylabel('Quadrature','FontSize',12)
177

346 title('Constellation With Offset No ICI','FontSize',12)


347 grid on
348 axis('square')
349 axis([-2 2 -2 2])
350

351 subplot(2,1,2)
352 plot(Y1,'rx')
353 hold on
354 plot(Y,'bo')
355 xlabel('In-Phase','FontSize',12)
356 ylabel('Quadrature','FontSize',12)
357 title('Constellation With Offset and ICI','FontSize',12)
358 grid on
359 grid on
360 axis('square')
361 axis([-2 2 -2 2])
362

363 [ax,h3]=suplabel('Constellation Diagram For Sampling...


364 Clock Offset of 1%','t');
365 set(h3,'FontSize',16')
366

367

368 figure('name','Thesis Sample Clock Offset Simulation-...


369 Magnitude of Attenuation and Phase of k{th} ...
370 Sub-carrier Index','position',Position)
371 subplot(2,1,1)
372 plot(0:Nfft-1,10*log10(abs(atten)))
373 grid on
374 title('Magnitude of Attenuation on k{th} Sub-carrier',...
375 'FontSize',12)
376 xlabel('Sub-carrier Index','FontSize',12)
377 ylabel('Magnitude [dB]','FontSize',12)
378 axis([0 64 -4 0])
379

380 subplot(2,1,2)
381 plot(0:Nfft-1,angle(atten))
382 grid on
383 title('Phase Offset on k{th} Sub-carrier','FontSize',12)
384 xlabel('Sub-carrier Index','FontSize',12)
385 ylabel('Phase [Rad]','FontSize',12)
386 axis([0 64 0 2.2])
387

388 [ax,h3]=suplabel('Attenuation and Phase Offset From 1%...


389 Sampling Offset on k{th} Sub-carrier','t');
178

390 set(h3,'FontSize',16)
391

392 for nn=0:Nfft-1


393 ICI=sin(pi*((1+epsilon)*k-nn))./sin(pi/Nfft*...
394 ((1+epsilon)*k-nn));
395 ICIpower(nn+1)=sum(abs(ICI((1:Nfft)6=(nn+1))).2)...
396 /Nfft2;
397 end
398

399 figure('name','Thesis Sample Clock Offset Simulation- ...


400 ICI Power','position',Position)
401 plot(k,10*log10(ICIpower),'r')
402 hold on
403 plot(k,10*log10(iciPower/numSims),'bo')
404 grid on
405 xlabel('Sub-carrier Index','FontSize',12)
406 ylabel('Power [dB]','FontSize',12)
407 title('ICI Power','FontSize',16)
408 legend({['Theoretical'];['Simulated']},...
409 'location','northwest','FontSize',12)
410 axis([0 64 -20 0])
411

412 figure('name','Thesis Sample Clock Offset Simulation- ...


413 Signal to ICI Power Ratio','position',Position)
414 plot(k,10*log10(sigPower./ICIpower))
415 grid on
416 xlabel('Sub-carrier Index','FontSize',12)
417 ylabel('Power [dB]','FontSize',12)
418 title('Signal to ICI Power Ratio','FontSize',16)
419 axis([0 64 15 40])
420

421

422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
424

425 %% -- SymbolTimingOffset.m ---------------------------------


426 % MATLAB Thesis Simulation
427 % Steven Hemple
428 % 9 April 2011
429 %
430 % This MATLAB simulation shows the effects of frame or
431 % symbol timing offset.
432 % ----------------------------------------------------------
433 clear all;
179

434 close all;


435 clc;
436

437 % -- Scipt Parameters --------------------------------------


438 %
439 % Screen 0 =Size and position of plots for screen 0
440 % Screen 1 =Size and position of plots for screen 1
441 % Screen 1 =Size and position of plots for dual monitor
442 % Position =Plot screen variable
443 % Plots =Toggle to turn plots on(1) or off(0)
444 % ----------------------------------------------------------
445 Screen 0=[550,10,800,650];
446 Screen 1=[1400,10,800,650];
447 Screen 2=[];
448 Position=Screen 0;
449 Plots=1;
450

451 %% -- Parameters -------------------------------------------


452 numSims=60;
453 bins=52;
454 zeta=8;
455 ICI Power=0;
456 ISI Power=0;
457 Interference=0;
458 M=4;
459 num=sqrt(M);
460

461 %% -- Simulate symbol offset with no cyclic prefix ---------


462 for Nfft=[64 256]
463 atten=(Nfft-zeta)/Nfft*exp(1j*2*pi*zeta*(0:Nfft-1)/Nfft);
464 y1=[];
465 ICI Power=0;
466 ISI Power=0;
467 for nn=1:numSims
468 x0 i=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
469 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
470 x0 ii=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
471 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
472

473 x1 i=ifft(x0 i);


474 x1 ii=ifft(x0 ii);
475

476 % -- Compute the demodulated symbol with attenuation


477 X1=x0 i. *atten;
180

478

479 % -- Demodulate offset frame


480 y1(nn,:)=fft([x1 i(zeta+1:end) x1 ii(1:zeta)]);
481

482 % -- Compute the ICI by demodulating frame 1 and


483 % subtracting the attenuation
484 ICI=fft([x1 i(zeta+1:end) zeros(1,zeta)])-atten;
485

486 % -- Compute the ISI by demodulating frame 2 only


487 ISI=fft([zeros(1,Nfft-zeta) x1 ii(1:zeta)]);
488

489

490

491 ICI Power=ICI Power+sum(abs(ICI).2);


492 ISI Power=ISI Power+sum(abs(ISI).2);
493

494 Interference=Interference+sum(abs(y1(nn,:)-X1).2);
495 end
496

497 % -- Compute average power of ICI,ISI, and Inteference


498 Avg ISI power=ISI Power/numSims;
499 Avg ICI power=ICI Power/numSims;
500 Avg Interference power=Interference/numSims;
501

502 % -- Compute ICI,ISI, and interference power from equations


503 ICI theory=(Nfft-zeta)*zeta/Nfft2;
504 ISI theory=zeta/Nfft;
505 Interference theory=(2*Nfft-zeta)*zeta/Nfft2;
506

507 figure('name','Thesis Frame Timing Offset Simulation-...


508 Effects of Frame Timing Offset','position',Position)
509 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
510 hold on
511 plot(y1(numSims,:),'rx')
512 axis([-2 2 -2 2])
513 axis('square')
514 grid on
515 xlabel('In-Phase','FontSize',12)
516 ylabel('Quadrature','FontSize',12)
517 title({['Symbols with Frame Offset with N {fft}=',...
518 num2str(Nfft)]},'FontSize',16)
519

520 figure('name','Thesis Frame Timing Offset Simulation-...


521 Effects of Frame Timing Offset','position',Position)
181

522 subplot(2,2,1)
523 plot(x0 i,'bo')
524 hold on
525 plot(X1,'rx')
526 axis([-2 2 -2 2])
527 axis('square')
528 grid on
529 xlabel('In-Phase','FontSize',12)
530 ylabel('Quadrature','FontSize',12)
531 title('Attenuation and Rotation')
532

533 subplot(2,2,2)
534 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
535 hold on
536 plot(ICI,'rx')
537 axis([-3 3 -3 3])
538 axis('square')
539 grid on
540 xlabel('In-Phase','FontSize',12)
541 ylabel('Quadrature','FontSize',12)
542 title('ICI contribution')
543

544 subplot(2,2,3)
545 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
546 hold on
547 plot(ISI,'rx')
548 axis([-1.2 1.2 -1.2 1.2])
549 axis('square')
550 grid on
551 xlabel('In-Phase','FontSize',12)
552 ylabel('Quadrature','FontSize',12)
553 title('ISI Contributon')
554

555 subplot(2,2,4)
556 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
557 hold on
558 plot(y1(numSims,:),'rx')
559 axis([-2 2 -2 2])
560 axis('square')
561 grid on
562 xlabel('In-Phase','FontSize',12)
563 ylabel('Quadrature','FontSize',12)
564 title('Symbols with Frame Offset')
565
182

566 if Nfft==64
567 [ax,h3]=suplabel('Effects of Frame Offset \zeta=8 Nfft=64','t');
568 set(h3,'FontSize',16)
569 else
570 [ax,h3]=suplabel('Effects of Frame Offset \zeta=8 Nfft=256','t');
571 set(h3,'FontSize',16)
572 end
573

574 figure('name','Thesis Frame Timing Offset Simulation-...


575 Effects of Frame Timing Offset','position',Position)
576 subplot(2,1,1)
577 plot(-Nfft/2:Nfft/2-1,real(y1),'bx')
578 grid on
579 title('Real Part of Spectrum','FontSize',12)
580 xlabel('Sample','FontSize',12)
581

582 subplot(2,1,2)
583 plot(-Nfft/2:Nfft/2-1,imag(y1),'rx')
584 grid on
585 title('Imaginary Part of Spectrum','FontSize',12)
586 xlabel('Sample','FontSize',12)
587

588 if Nfft==64
589 [ax,h3]=suplabel('Effects of Frame Offset \zeta=8 Nfft=64','t');
590 set(h3,'FontSize',16)
591 else
592 [ax,h3]=suplabel('Effects of Frame Offset \zeta=8 Nfft=256','t');
593 set(h3,'FontSize',16)
594 end
595 end
596

597 %% -- Simulate symbol offset with cyclic prefix ------------


598 Nfft=64;
599 cp=Nfft/4;
600 for nn=1:numSims
601 x0 i=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
602 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
603 x0 ii=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
604 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
605

606 x1 i=ifft(x0 i);


607 x1 ii=ifft(x0 ii);
608

609 x2 i=[x1 i(end-cp+1:end) x1 i];


183

610 x2 ii=[x1 ii(end-cp+1:end) x1 ii];


611

612 reg1=[x2 i(end-zeta+1:end) x2 ii(1:end-zeta)];


613 reg2=reg1(cp+1:end);
614 y2(nn,:)=fft(reg2);
615 end
616

617 figure('name','Thesis Frame Timing Offset Simulation-...


618 Effects of Frame Timing Offset With Cyclic Prefix',...
619 'position',Position)
620 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
621 hold on
622 plot(y2,'rx')
623 hold off
624 grid on
625 legend('No Offset','Offset')
626 xlabel('In-Phase','FontSize',12)
627 ylabel('Quadrature','FontSize',12)
628 title('Frame Timing Offset \zeta=8 With Cyclic Prefix',...
629 'FontSize',16)
630 axis('square')
631

632

633

634 %% -- Simulation with channel and cyclic prefix ------------


635 h1=[1 0 0.1j 0.1 0 0 0.05j];
636 h2=[1 0 0 0.3 0 0.25j 0 0.1+0.15j];
637 Nfft=64;
638 cp=16;
639

640 figure
641 subplot(2,1,1)
642 plot(1:Nfft,20*log10(abs(fftshift(fft(h1,Nfft)))))
643

644 subplot(2,1,2)
645 plot(1:Nfft,abs(ifft(fft(h1,Nfft))))
646 for nn=1:numSims
647 x0 i=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
648 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
649 x0 ii=(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2)...
650 +1j*(floor(num*rand(1,Nfft))-(num-1)/2)/((num-1)/2);
651

652 x1 i=ifft(fftshift(x0 i));


653 x1 ii=ifft(fftshift(x0 ii));
184

654

655 x2 i=[x1 i(end-cp+1:end) x1 i];


656 x2 ii=[x1 ii(end-cp+1:end) x1 ii];
657

658 x3 i=filter(h1,1,x2 i);


659 x3 ii=filter(h1,1,x2 ii);
660

661 reg1=[x3 i(end-zeta+1:end) x3 ii(1:end-zeta)];


662 reg2=[x2 i(end-zeta+1:end) x2 ii(1:end-zeta)];
663 reg3=reg1(cp+1:end);
664 reg4=reg2(cp+1:end);
665

666 y3(nn,:)=fftshift(fft(reg3));
667 y4(nn,:)=fftshift(fft(reg4));
668 end
669

670 figure('name','Thesis Frame Timing Offset Simulation-...


671 Effects of Frame Timing Offset With Cyclic Prefix',...
672 'position',Position)
673 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
674 hold on
675 plot(y4,'rx')
676 hold off
677 grid on
678 xlabel('In-Phase','FontSize',12)
679 ylabel('Quadrature','FontSize',12)
680 legend('No Offset','Offset')
681 title('Frame Timing Offset \zeta=8 With Cyclic Prefix ...
682 Ideal Channel','FontSize',16)
683 axis('square')
684

685

686 figure('name','Thesis Frame Timing Offset Simulation-...


687 Effects of Frame Timing Offset With Cyclic Prefix',...
688 'position',Position)
689 subplot(2,1,1)
690 plot(-Nfft/2:Nfft/2-1,real(y4),'bx')
691 grid on
692 title('Real Part of Spectrum','FontSize',12)
693 xlabel('Samples','FontSize',12)
694

695 subplot(2,1,2)
696 plot(-Nfft/2:Nfft/2-1,imag(y4),'rx')
697 grid on
185

698 title('Imaginary Part of Spectrum','FontSize',12)


699 xlabel('Samples','FontSize',12)
700

701 [ax,h3]=suplabel('Effects of Symbol Timing Offset With ...


702 Cyclic Prefix With No Channel','t');
703 set(h3,'FontSize',16)
704

705

706 figure('name','Thesis Frame Timing Offset Simulation-...


707 Effects of Frame Timing Offset With Cyclic Prefix',...
708 'position',Position)
709 plot(x0 i,'bo','MarkerSize',6,'LineWidth',2)
710 hold on
711 plot(y3,'rx')
712 hold off
713 grid on
714 xlabel('In-Phase','FontSize',12)
715 ylabel('Quadrature','FontSize',12)
716 legend('No Offset','Offset')
717 title('Frame Timing Offset \zeta=8 With Cyclic Prefix ...
718 Mutipath channel','FontSize',16)
719 axis('square')
720

721

722

723 figure('name','Thesis Frame Timing Offset Simulation-...


724 Effects of Frame Timing Offset With Cyclic Prefix',...
725 'position',Position)
726 subplot(2,1,1)
727 plot(-Nfft/2:Nfft/2-1,real(y3),'bx')
728 grid on
729 title('Real Part of Spectrum','FontSize',12)
730 xlabel('Sample','FontSize',12)
731

732 subplot(2,1,2)
733 plot(-Nfft/2:Nfft/2-1,imag(y3),'rx')
734 grid on
735 title('Imaginary Part of Spectrum','FontSize',12)
736 xlabel('Sample','FontSize',12)
737

738 [ax,h3]=suplabel('Effects of Symbol Timing Offset With...


739 Cyclic Prefix and Channel','t');
740 set(h3,'FontSize',16)
741
186

742

743 %% -- Interference Power -----------------------------------


744 Nfft=64;
745 zeta=0:Nfft/2;
746

747 ICIpower=(Nfft-zeta).*zeta/Nfft2;
748 ISIpower=zeta/Nfft;
749 Total=(2*Nfft-zeta).*zeta/Nfft2;
750

751 figure('name','Thesis Frame Timing Offset Simulation-...


752 Effects of Frame Timing Offset With Cyclic Prefix',...
753 'position',Position)
754 subplot(2,2,1)
755 plot(zeta,10*log10(ICIpower))
756 grid on
757 title('Power in ICI','FontSize',12)
758 xlabel('Offset [\zeta]','FontSize',12)
759 ylabel('Power [dB]','FontSize',12)
760

761 subplot(2,2,2)
762 plot(zeta,10*log10(ISIpower))
763 grid on
764 title('Power in ISI','FontSize',12)
765 xlabel('Offset [\zeta]','FontSize',12)
766 ylabel('Power [dB]','FontSize',12)
767

768 subplot(2,1,2)
769 plot(zeta,10*log10(Total))
770 grid on
771 title('Total Interference','FontSize',12)
772 xlabel('Offset [\zeta]','FontSize',12)
773 ylabel('Power [dB]','FontSize',12)
774

775 [ax,h3]=suplabel('Interference Power for N {fft}=64','t');


776 set(h3,'FontSize',16)
187

APPENDIX E
MATLAB CODE FOR PREAMBLE AND
SYNCHRONIZATION ERROR ESTIMATION
188

MATLAB CODE FOR PREAMBLE AND


SYNCHRONIZATION ERROR ESTIMATION

1 %% -- Preamble.m -------------------------------------------
2 % MATLAB Thesis Simulation
3 % Steven Hemple
4 %
5 % This MATLAB script will simulate the preamble for OFDM as
6 % used in IEEE 802.11a. Both the short and long training
7 % symbols are hard coded and bseband modualted usign the
8 % IFFT.
9 % ----------------------------------------------------------
10 clear all;
11 close all;
12 clc;
13 % -- Simulation Parameters ---------------------------------
14 %
15 % Screen 0 =Size and position of plots for screen 0
16 % Screen 1 =Size and position of plots for screen 1
17 % Screen 1 =Size and position of plots for dual monitor
18 % Position =Plot screen variable
19 % Plots =Toggle to turn plots on(1) or off(0)
20 % Nfft =Number of subcarriers
21 % CP Length =Length of the cyclic prefix
22 % ----------------------------------------------------------
23 Screen 0=[550,10,800,650];
24 Screen 1=[1400,10,800,650];
25 Screen 2=[];
26 Position=Screen 0;
27 Plots=1;
28

29 Nfft=64;
30 CP Length=16;
31

32 % -- Short Training Symbols --------------------------------


33 STS=[zeros(1,6) 0 0 1+1j 0 0 0 -1-1j 0 0 0 ...
34 1+1j 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
35 0 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
36 1+1j 0 0 0 1+1j 0 0 0 1+1j 0 0 zeros(1,5) ];
189

37 STS IFFT Input=sqrt(13/6)*fftshift(STS);


38 STS IFFT Output=ifft(STS IFFT Input,Nfft);
39 x STS=[STS IFFT Output STS IFFT Output ...
40 STS IFFT Output(1:Nfft/2)];
41

42 % -- Long Training Symbols ---------------------------------


43 LTS=[zeros(1,6) 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 ...
44 1 1 -1 1 -1 1 1 1 1 0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 ...
45 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 zeros(1,5)];
46 LTS IFFT Input=fftshift(LTS);
47 LTS IFFT Output=ifft(LTS IFFT Input);
48 x LTS=[LTS IFFT Output(Nfft-2*CP Length+1:Nfft)...
49 LTS IFFT Output LTS IFFT Output];
50

51 %% -- Figures ----------------------------------------------
52 % Plots of the short and long training symbols' spectrum and
53 % time series.
54 % ----------------------------------------------------------
55 if Plots
56 % Figure 1
57 figure('name',...
58 'Thesis OFDM Simulation- OFDM Preamble Spectrum',...
59 'position',Position)
60 subplot(2,1,1)
61 stem(-32:31,real(STS),'r','LineWidth',2)
62 axis([-32 31 -1.5 1.5])
63 grid on
64 xlabel('Frequency Bin')
65 title('Real Part','FontSize',12)
66

67 subplot(2,1,2)
68 stem(-32:31,imag(STS),'b','LineWidth',2)
69 axis([-32 31 -1.5 1.5])
70 grid on
71 xlabel('Frequency Bin')
72 title('Imaginary Part','FontSize',12)
73

74 [ax,h3]=suplabel('Spectrum of OFDM Short Training Symbol'...


75 ,'t');
76 set(h3,'FontSize',16);
77

78 figure('name',...
79 'Thesis OFDM Simulation- OFDM Preamble Spectrum',...
80 'position',Position)
190

81 subplot(2,1,1)
82 stem(-32:31,abs(STS),'r','LineWidth',2)
83 axis([-32 31 -1.5 1.5])
84 grid on
85 xlabel('Frequency Bin')
86 title('Real Part','FontSize',12)
87

88 subplot(2,1,2)
89 plot(0:1/20:8-1/20,abs(x STS),'r')
90

91 [ax,h3]=suplabel('Spectrum of OFDM Long Training Symbol'...


92 ,'t');
93 set(h3,'FontSize',16);
94 % Figure 2
95 figure('name',...
96 'Thesis OFDM Simulation- OFDM Preamble Spectrum',...
97 'position',Position)
98 subplot(2,1,1)
99 stem(-32:31,real(LTS),'r','LineWidth',2)
100 axis([-32 31 -1.5 1.5])
101 grid on
102 xlabel('Frequency Bin')
103 title('Real Part','FontSize',12)
104

105 subplot(2,1,2)
106 stem(-32:31,imag(LTS),'b','LineWidth',2)
107 axis([-32 31 -1.5 1.5])
108 grid on
109 xlabel('Frequency Bin')
110 title('Imaginary Part','FontSize',12)
111

112 [ax,h3]=suplabel('Spectrum of OFDM Long Training Symbol'...


113 ,'t');
114 set(h3,'FontSize',16);
115

116

117

118 % Figure 3
119 figure('name',...
120 'Thesis OFDM Simulation- OFDM Preamble Time Series',...
121 'position',Position)
122 subplot(2,1,1)
123 hold on
124 for nn=0:1.6:8
191

125 plot([nn nn],[-0.2 0.2],'-.k')


126 rectangle('Position',[nn, -0.2, 0.8,0.5],...
127 'FaceColor',[0.9 0.9 0.9],'LineStyle','-.')
128

129 end
130 plot(0:1/20:8-1/20,zeros(1,160),'k','LineWidth',1)
131 plot([0 0],[-0.2 0.2],'k','LineWidth',1)
132 plot(4.0/80*(0:length(x STS)-1),real(x STS),'r',...
133 'LineWidth',2)
134 axis([0 8 -0.2 0.2])
135 set(gca,'YTickLabel',[])
136 xlabel('Time [\mu s]')
137 title('Real Part','Fontsize',12)
138

139 subplot(2,1,2)
140 hold on
141 for nn=0:1.6:8
142 plot([nn nn],[-0.2 0.2],'-.k')
143 rectangle('Position',[nn, -0.2, 0.8,0.5],...
144 'FaceColor',[0.9 0.9 0.9],'LineStyle','-.')
145

146 end
147 plot(0:1/20:8-1/20,zeros(1,160),'k','LineWidth',1)
148 plot([0 0],[-0.2 0.2],'k','LineWidth',1)
149 plot(4.0/80*(0:length(x STS)-1),imag(x STS),...
150 'LineWidth',2)
151 axis([0 8 -0.2 0.2])
152 set(gca,'YTickLabel',[])
153 xlabel('Time [\mu s]')
154 title('Imaginary Part','Fontsize',12)
155

156 [ax,h3]=suplabel('Time Series of Short Training Symbols'...


157 ,'t');
158 set(h3,'FontSize',16)
159

160 % Figure 4
161 figure('name',...
162 'Thesis OFDM Simulation- OFDM Preamble Time Series',...
163 'position',Position)
164 subplot(2,1,1)
165 rectangle('Position',[0.025, -0.2, 32*0.05,0.5],...
166 'FaceColor',[1 1 .2],'LineStyle','-.')
167 hold on
168 rectangle('Position',...
192

169 [32*0.05+0.025, -0.2, 63*0.05,0.5],'FaceColor',...


170 [0.95 0.95 0.95],'LineStyle','-.')
171 rectangle('Position',...
172 [96*0.05-.025, -0.2, 64*0.05,0.5],'FaceColor',...
173 [0.9 0.9 0.9],'LineStyle','-.')
174

175 plot(1/20:1/20:8,zeros(1,160),'k','LineWidth',1)
176 axis([0 8 -0.2 0.2])
177 set(gca,'YTick',[])
178 plot(4.0/80*(0:length(x LTS)-1),real(x LTS),'r',...
179 'LineWidth',2)
180 xlabel('Time [\mu s]')
181 title('Real Part','Fontsize',12)
182

183 mTextBox=uicontrol('style','text')
184 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
185 set(mTextBox,'Position',[120 580 100 20])
186 set(mTextBox,'BackgroundColor',[1 1 .2])
187

188 mTextBox=uicontrol('style','text')
189 set(mTextBox,'String','First Symbol','FontSize',12)
190 set(mTextBox,'Position',[300 580 100 20])
191 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
192

193 mTextBox=uicontrol('style','text')
194 set(mTextBox,'String','Second Symbol','FontSize',12)
195 set(mTextBox,'Position',[530 580 120 20])
196 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9])
197

198

199

200

201 subplot(2,1,2)
202 rectangle('Position',[0.025, -0.2, 32*0.05,0.5],...
203 'FaceColor',[1 1 .2],'LineStyle','-.')
204 hold on
205 rectangle('Position',...
206 [32*0.05+0.025, -0.2, 63*0.05,0.5],'FaceColor',...
207 [0.95 0.95 0.95],'LineStyle','-.')
208 rectangle('Position',...
209 [96*0.05-.025, -0.2, 64*0.05,0.5],'FaceColor',...
210 [0.9 0.9 0.9],'LineStyle','-.')
211

212 plot(1/20:1/20:8,zeros(1,160),'k','LineWidth',1)
193

213 axis([0 8 -0.2 0.2])


214 set(gca,'YTick',[])
215 plot(4.0/80*(0:length(x LTS)-1),imag(x LTS),...
216 'LineWidth',2)
217 xlabel('Time [\mu s]')
218 title('Imaginary Part','Fontsize',12)
219

220 mTextBox=uicontrol('style','text')
221 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
222 set(mTextBox,'Position',[120 273 100 20])
223 set(mTextBox,'BackgroundColor',[1 1 .2])
224

225 mTextBox=uicontrol('style','text')
226 set(mTextBox,'String','First Symbol','FontSize',12)
227 set(mTextBox,'Position',[300 273 100 20])
228 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
229

230 mTextBox=uicontrol('style','text')
231 set(mTextBox,'String','Second Symbol','FontSize',12)
232 set(mTextBox,'Position',[530 273 120 20])
233 set(mTextBox,'BackgroundColor',[0.9 0.9 0.9])
234

235

236 [ax,h3]=suplabel('Time Series of Long Training Symbols'...


237 ,'t');
238 set(h3,'FontSize',16)
239

240 % Figure 5
241 figure('name',...
242 'Thesis OFDM Simulation- OFDM Preamble Time Series',...
243 'position',Position)
244 subplot(3,1,1)
245 hold on
246 rectangle('Position',[0, -0.2, 0.8,0.6],'FaceColor',...
247 [1 1 0.2],'LineStyle','-.')
248 rectangle('Position',[0.8, -0.2, 0.8,0.6],'FaceColor',...
249 [1 1 0.2],'LineStyle','-.')
250 for nn=1.6:1.6:8
251 plot([nn nn],[-0.2 0.2],'-.k')
252 rectangle('Position',[nn, -0.2, 0.8,0.6],'FaceColor',...
253 [0.95 0.95 0.95],'LineStyle','-.')
254 rectangle('Position',[nn+0.8, -0.2, 0.8,0.6],...
255 'FaceColor',[0.89 0.89 0.89],'LineStyle','-.')
256 end
194

257 rectangle('Position',[8, -0.2, 1.6,0.6],'FaceColor',...


258 [1 1 0.2],'LineStyle','-.')
259 rectangle('Position',[9.6, -0.2, 3.2,0.6],'FaceColor',...
260 [0.95 0.95 0.95],'LineStyle','-.')
261 rectangle('Position',[12.8, -0.2, 3.2,0.6],'FaceColor',...
262 [0.89 0.89 0.89],'LineStyle','-.')
263

264 plot(4.0/80*(0:319),real([x STS x LTS]),'r',...


265 'LineWidth',2)
266 hold on
267 plot([8 8],[-0.3 0.3],'k','LineWidth',1)
268 plot(0:1/20:16-1/20,zeros(1,320),'k','LineWidth',1)
269 xlabel('Time [\mu s]')
270 set(gca,'YTick',[])
271 axis([0 16 -0.2 0.3])
272 title('Real Part','FontSize',12)
273 grid on
274

275 mTextBox=uicontrol('style','text')
276 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
277 set(mTextBox,'Position',[110 555 50 37])
278 set(mTextBox,'BackgroundColor',[1 1 .2])
279

280 mTextBox=uicontrol('style','text')
281 set(mTextBox,'String','Short Symbols','FontSize',12)
282 set(mTextBox,'Position',[230 570 120 20])
283 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
284

285 mTextBox=uicontrol('style','text')
286 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
287 set(mTextBox,'Position',[420 555 50 37])
288 set(mTextBox,'BackgroundColor',[1 1 .2])
289

290 mTextBox=uicontrol('style','text')
291 set(mTextBox,'String','Long Symbols','FontSize',12)
292 set(mTextBox,'Position',[550 570 100 20])
293 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
294

295

296

297 subplot(3,1,2)
298 hold on
299 rectangle('Position',[0, -0.2, 0.8,0.6],'FaceColor',...
300 [1 1 0.2],'LineStyle','-.')
195

301 rectangle('Position',[0.8, -0.2, 0.8,0.6],'FaceColor'...


302 ,[1 1 0.2],'LineStyle','-.')
303 for nn=1.6:1.6:8
304 plot([nn nn],[-0.2 0.2],'-.k')
305 rectangle('Position',[nn, -0.2, 0.8,0.6],'FaceColor'...
306 ,[0.95 0.95 0.95],'LineStyle','-.')
307 rectangle('Position',[nn+0.8, -0.2, 0.8,0.6],...
308 'FaceColor',[0.89 0.89 0.89],'LineStyle','-.')
309 end
310 rectangle('Position',[8, -0.2, 1.6,0.6],'FaceColor',...
311 [1 1 0.2],'LineStyle','-.')
312 rectangle('Position',[9.6, -0.2, 3.2,0.6],'FaceColor'...
313 ,[0.95 0.95 0.95],'LineStyle','-.')
314 rectangle('Position',[12.8, -0.2, 3.2,0.6],'FaceColor'...
315 ,[0.89 0.89 0.89],'LineStyle','-.')
316

317 plot(4.0/80*(0:319),imag([x STS x LTS]),'LineWidth',2)


318

319 plot([8 8],[-0.3 0.3],'k','LineWidth',1)


320 plot(0:1/20:16-1/20,zeros(1,320),'k','LineWidth',1)
321

322 xlabel('Time [\mu s]')


323 set(gca,'YTick',[])
324 title('Imaginary Part','FontSize',12)
325 grid on
326 axis([0 16 -0.2 0.3])
327

328

329 mTextBox=uicontrol('style','text')
330 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
331 set(mTextBox,'Position',[110 362 50 37])
332 set(mTextBox,'BackgroundColor',[1 1 .2])
333

334 mTextBox=uicontrol('style','text')
335 set(mTextBox,'String','Short Symbols','FontSize',12)
336 set(mTextBox,'Position',[230 377 120 20])
337 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
338

339 mTextBox=uicontrol('style','text')
340 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
341 set(mTextBox,'Position',[420 362 50 37])
342 set(mTextBox,'BackgroundColor',[1 1 0.2])
343

344 mTextBox=uicontrol('style','text')
196

345 set(mTextBox,'String','Long Symbols','FontSize',12)


346 set(mTextBox,'Position',[550 377 100 20])
347 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
348

349 subplot(3,1,3)
350 hold on
351 rectangle('Position',[0, -0.2, 0.8,0.6],'FaceColor',...
352 [1 1 0.2],'LineStyle','-.')
353 rectangle('Position',[0.8, -0.2, 0.8,0.6],'FaceColor'...
354 ,[1 1 0.2],'LineStyle','-.')
355 for nn=1.6:1.6:8
356 plot([nn nn],[-0.2 0.2],'-.k')
357 rectangle('Position',[nn, -0.2, 0.8,0.6],'FaceColor'...
358 ,[0.95 0.95 0.95],'LineStyle','-.')
359 rectangle('Position',[nn+0.8, -0.2, 0.8,0.6],...
360 'FaceColor',[0.89 0.89 0.89],'LineStyle','-.')
361 end
362 rectangle('Position',[8, -0.2, 1.6,0.6],'FaceColor',...
363 [1 1 0.2],'LineStyle','-.')
364 rectangle('Position',[9.6, -0.2, 3.2,0.6],'FaceColor'...
365 ,[0.95 0.95 0.95],'LineStyle','-.')
366 rectangle('Position',[12.8, -0.2, 3.2,0.6],'FaceColor'...
367 ,[0.89 0.89 0.89],'LineStyle','-.')
368

369 plot(4.0/80*(0:319),abs([x STS x LTS]),'LineWidth',2)


370

371 plot([8 8],[-0.3 0.3],'k','LineWidth',1)


372 plot(0:1/20:16-1/20,zeros(1,320),'k','LineWidth',1)
373 axis([0 16 0.03 0.25])
374 xlabel('Time [\mu s]')
375 set(gca,'YTick',[])
376 title('Magnitude of Preamble','FontSize',12)
377 grid on
378

379

380

381 mTextBox=uicontrol('style','text')
382 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
383 set(mTextBox,'Position',[110 164 50 37])
384 set(mTextBox,'BackgroundColor',[1 1 .2])
385

386 mTextBox=uicontrol('style','text')
387 set(mTextBox,'String','Short Symbols','FontSize',12)
388 set(mTextBox,'Position',[230 180 120 20])
197

389 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])


390

391 mTextBox=uicontrol('style','text')
392 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
393 set(mTextBox,'Position',[420 164 50 37])
394 set(mTextBox,'BackgroundColor',[1 1 0.2])
395

396 mTextBox=uicontrol('style','text')
397 set(mTextBox,'String','Long Symbols','FontSize',12)
398 set(mTextBox,'Position',[550 180 100 20])
399 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
400

401

402 [ax,h3]=suplabel('Preamble Sturcture for IEEE 802.11a'...


403 ,'t');
404 set(h3,'FontSize',16)
405 end
406

407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
409

410 %% -- CoarseTiming.m ---------------------------------------


411 % MATLAB Thesis Simulation
412 % Steven Hemple
413 %
414 % This MATLAB script will simulate the preamble for OFDM as
415 % used in IEEE 802.11a. Both the short and long training
416 % symbols are hard coded and bseband modualted usign the
417 % IFFT.
418 % ----------------------------------------------------------
419 clear all;
420 close all;
421 clc;
422 % -- Simulation Parameters ---------------------------------
423 %
424 % Screen 0 =Size and position of plots for screen 0
425 % Screen 1 =Size and position of plots for screen 1
426 % Screen 1 =Size and position of plots for dual monitor
427 % Position =Plot screen variable
428 % Plots =Toggle to turn plots on(1) or off(0)
429 % Nfft =Number of subcarriers
430 % CP Length =Length of the cyclic prefix
431 % L =Length of moving average filter(Must be multiple of
432 % short symbol length)
198

433 % ----------------------------------------------------------
434 Screen 0=[550,10,800,650];
435 Screen 1=[1400,10,800,650];
436 Screen 2=[];
437 Position=Screen 0;
438 Plots=1;
439

440 Nfft=64;
441 CP Length=16;
442 L=16;
443 % -- Short Training Symbols --------------------------------
444 STS=[zeros(1,6) 0 0 1+1j 0 0 0 -1-1j 0 0 0 ...
445 1+1j 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
446 0 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
447 1+1j 0 0 0 1+1j 0 0 0 1+1j 0 0 zeros(1,5) ];
448 STS IFFT Input=sqrt(13/6)*fftshift(STS);
449 STS IFFT Output=ifft(STS IFFT Input,Nfft);
450 x STS=[STS IFFT Output STS IFFT Output ...
451 STS IFFT Output(1:Nfft/2)];
452

453 % -- Long Training Symbols ---------------------------------


454 LTS=[zeros(1,6) 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 ...
455 1 1 -1 1 -1 1 1 1 1 0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 ...
456 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 zeros(1,5)];
457 LTS IFFT Input=fftshift(LTS);
458 LTS IFFT Output=ifft(LTS IFFT Input);
459 x LTS=[LTS IFFT Output(Nfft-2*CP Length+1:Nfft) ...
460 LTS IFFT Output LTS IFFT Output];
461

462 %% --Coarse Timing Algortihm -------------------------------


463 % y =Values for noise freq offset and
464 % sigma =Variance of noise
465 % f =Frequency offset
466 % Noise =Gaussian Noise
467 % Rx =Received signal with noise prepended
468 %
469 %
470 % ----------------------------------------------------------
471 y=[0 0 0.01 0.044 0.64 2.5];
472 for n=1:length(y)/3
473 sigma=y((n-1)*3+1);
474 f=y((n-1)*3+2);

475 =y(n*3);

476 Noise1=sigma*(rand(1,50)+1j*rand(1,50));
199

477 Noise2=sigma*(rand(1,320)+1j*rand(1,320));
478

479 Rx=[Noise1 exp(1j*2*pi*(0:length([x STS x LTS])-1)*...


480 f/Nfft).*([x STS x LTS]+Noise2)];

481

482 figure('name','Thesis OFDM Simulation- Preamble',...


483 'position',Position)
484 subplot(2,1,1)
485 plot(1:length(Rx),real(Rx),'r');
486 title('Real Part','FontSize',12)
487 grid on
488

489 subplot(2,1,2)
490 plot(1:length(Rx),imag(Rx));
491 title('Imaginary Part','FontSize',12)
492 grid on
493

494 [ax,h3]=suplabel('IEEE 802.11a Preamble Prepended ...


495 With 50 Samples','t');
496 set(h3,'FontSize',16);
497

498 % -- Coarse timing estimation ------------------------------


499 % reg1 =Moving average register top path
500 % P(d) =Output of top path (correlate with delayed copy)
501 % reg2 =Moving average register bottom path
502 % R(d) =Output of bottom path (received power)
503 % M(d) =Square of normalized correlator output
504 % start =Time index when M(d)>0.5
505 % frame =Frame decision
506 % ----------------------------------------------------------
507 reg1=zeros(1,L);
508 reg2=reg1;
509 scl=max(abs([x STS]));
510 d=1;
511 m=1;
512 flag=1;
513 for nn=1+L:length(Rx)
514 % Correlation with delay
515 reg1=[Rx(nn)/scl.*conj(Rx(nn-16))/scl reg1(1:end-1)];
516 P(d)=(sum(reg1));
517

518 % Received power


519 reg2=[Rx(nn-L)/scl.*conj(Rx(nn-16))/scl reg2(1:end-1)];
520 R(d)=(real(sum(reg2)));
200

521

522 % Test value


523 M(d)=abs(P(d))2/(R(d)2+);
524

525 % Threshold detector


526 if M(d)0.5
527 if flag
528 start=d;
529 flag=0;
530 end
531 frame(m)=1;
532 m=m+1;
533 end
534 if M(d)<0.5
535 frame(m)=0;
536 m=m+1;
537 end
538 d=d+1;
539 end
540

541 figure('name','Thesis OFDM Simulation-,,,


542 Correlation with Delay',...
543 'position',Position)
544 subplot(2,2,1)
545 plot(1:length(P),abs(P))
546 title('Top Path (Correlation With Delyed Copy)',...
547 'FontSize',12)
548 xlabel('Sample')
549 grid on
550 axis([0 270 0 15])
551

552 subplot(2,2,2)
553 plot(1:length(R),(R))
554 title('Bottom Path (Received Power)','FontSize',12)
555 xlabel('Sample')
556 grid on
557 axis([0 270 0 15])
558

559 subplot(2,1,2)
560 plot(frame,'-.k','LineWidth',3)
561 hold on
562 plot(1:length(M),M,'LineWidth',1)
563 plot([start-5:start+5],ones(1,11)*0.5,'k','LineWidth',2)
564 xlabel('Sample')
201

565 grid on
566 axis([0 270 0 1.5]);
567 title('Output of Coarse Timing Estimator','FontSize',12);
568

569 if n==1
570 [ax,h3]=suplabel('Frame Timing Estimation With...
571 Ideal Channel','t');
572 set(h3,'FontSize',16);
573 else
574 [ax,h3]=suplabel('Frame Timing Estimation With...
575 Frequency Offset=200kHz, SNR=7dB','t');
576 set(h3,'FontSize',16);
577 end
578 end
579

580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
582

583 %% -- FineTimingEst.m --------------------------------------


584 % MATLAB Thesis Simulation
585 % Steven Hemple
586 %
587 % This MATLAB script will simulate the preamble for OFDM as
588 % used in IEEE 802.11a. Both the short and long training
589 % symbols are hard coded and bseband modualted usign the
590 % IFFT. The received preamble is then cross-correlated with
591 % the known long training symbol. The resulting peaks show
592 % the end of the cyclic prefix and the two OFDM symbols.
593 % ----------------------------------------------------------
594 clc;clear all;close all;
595

596 % -- Plot Parameters ---------------------------------------


597 %
598 % Screen 0 =Size and position of plots for screen 0
599 % Screen 1 =Size and position of plots for dual monitors
600 % Screen 1 =Size and position of plots for HDMI Out
601 % (1080i)
602 % Position =Plot screen variable
603 % Plots =Toggle to turn plots on(1) or off(0)
604 % ----------------------------------------------------------
605 Screen 0=[550,10,800,650];
606 Screen 1=[1400,10,800,650];
607 Screen 2=[1360,-310,1920,1024];
608 Position=Screen 0;
202

609 Plots=1;
610

611

612 % OFDM pararmeters -----------------------------------------


613 Nfft=64;
614 CP Length=16;
615

616 % -- OFDM Preamble -----------------------------------------


617 STS=[zeros(1,6) 0 0 1+1j 0 0 0 -1-1j 0 0 0 ...
618 1+1j 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
619 0 0 0 0 -1-1j 0 0 0 -1-1j 0 0 0 1+1j 0 0 0 ...
620 1+1j 0 0 0 1+1j 0 0 0 1+1j 0 0 zeros(1,5) ];
621 STS IFFT Input=sqrt(13/6)*fftshift(STS);
622 STS IFFT Output=ifft(STS IFFT Input,Nfft);
623 x STS=[STS IFFT Output STS IFFT Output ...
624 STS IFFT Output(1:Nfft/2)];
625

626

627 LTS=[zeros(1,6) 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 ...


628 1 1 -1 1 -1 1 1 1 1 0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 ...
629 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 zeros(1,5)];
630 LTS IFFT Input=fftshift(LTS);
631 LTS IFFT Output=ifft(LTS IFFT Input);
632 x LTS=[LTS IFFT Output(Nfft-2*CP Length+1:end) ...
633 LTS IFFT Output LTS IFFT Output];
634

635 x Preamble=[x STS x LTS];


636

637 % -- Cross-correlation
638 r=conv(x Preamble,fliplr(conj(LTS IFFT Output)));
639 r=r/max(abs(r));
640

641 %% -- Figures ----------------------------------------------


642 figure('position',Position)
643 subplot(2,1,1)
644 stem(real(STS))
645 title('Real Part of STS')
646

647 subplot(2,1,2)
648 stem(real(LTS))
649 title('Real Part of LTS')
650

651

652 figure('position',Position)
203

653 subplot(2,1,1)
654 hold on
655 rectangle('Position',[0, -0.2, 16,0.6],'FaceColor',...
656 [1 1 0.2],'LineStyle','-.')
657 rectangle('Position',[16, -0.2, 16,0.6],'FaceColor',...
658 [1 1 0.2],'LineStyle','-.')
659 for nn=32:32:160
660 plot([nn nn],[-0.2 0.2],'-.k')
661 rectangle('Position',[nn, -0.2, 16,0.6],'FaceColor',...
662 [0.95 0.95 0.95],'LineStyle','-.')
663 rectangle('Position',[nn+16, -0.2, 16,0.6],'FaceColor',...
664 [0.89 0.89 0.89],'LineStyle','-.')
665 end
666 rectangle('Position',[160, -0.2, 32,0.6],'FaceColor',...
667 [1 1 0.2],'LineStyle','-.')
668 rectangle('Position',[192, -0.2, 64,0.6],'FaceColor',...
669 [0.95 0.95 0.95],'LineStyle','-.')
670 rectangle('Position',[256, -0.2, 64,0.6],'FaceColor',...
671 [0.89 0.89 0.89],'LineStyle','-.')
672

673 plot((1:320),real([x STS x LTS]),'r','LineWidth',2)


674 hold on
675 plot([160 160],[-0.3 0.3],'k','LineWidth',1)
676 plot(0:319,zeros(1,320),'k','LineWidth',1)
677 xlabel('Sample')
678 set(gca,'YTick',[])
679 axis([1 324 -0.2 0.31])
680 set(gca,'XTick',[[0:16:160] 192 256 320])
681 title('Real Part','FontSize',12)
682 grid on
683

684 mTextBox=uicontrol('style','text');
685 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
686 set(mTextBox,'Position',[110 555 50 37])
687 set(mTextBox,'BackgroundColor',[1 1 .2])
688

689 mTextBox=uicontrol('style','text');
690 set(mTextBox,'String','Short Symbols','FontSize',12)
691 set(mTextBox,'Position',[230 570 120 20])
692 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
693

694 mTextBox=uicontrol('style','text');
695 set(mTextBox,'String','Cyclic Prefix','FontSize',12)
696 set(mTextBox,'Position',[420 555 50 37])
204

697 set(mTextBox,'BackgroundColor',[1 1 .2])


698

699 mTextBox=uicontrol('style','text');
700 set(mTextBox,'String','Long Symbols','FontSize',12)
701 set(mTextBox,'Position',[550 570 100 20])
702 set(mTextBox,'BackgroundColor',[0.95 0.95 0.95])
703 title('IEEE 802.11a Preamble','FontSize',12)
704

705

706 subplot(2,1,2)
707 plot(1:length(r),real(r))
708 axis([1 324 -0.2 1.2])
709 grid on
710 set(gca,'XTick',[[0:16:160] 192 256 320],'YTick',[0 0.5 1])
711 title('Cross-Correlation of Known LTS and Received LTS',...
712 'FontSize',12)
713

714 [ax,h3]=suplabel('Fine Timing Estimation','t');


715 set(h3,'FontSize',16)
716

717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719

720 %% -- ChannelEst.m -----------------------------------------


721 % MATLAB Thesis Simulation
722 % Steven Hemple
723 %
724 % This MATLAB script will simulate the preamble for OFDM as
725 % used in IEEE 802.11a. Both the short and long training
726 % symbols are hard coded and bseband modualted using the
727 % IFFT. The signal is passed through a multipath channel.
728 % The output of the channel is then used to estimate the
729 % channel frequency response and corrected.
730 % ----------------------------------------------------------
731 clc;clear all;close all;
732

733 % -- Plot Parameters ---------------------------------------


734 %
735 % Screen 0 =Size and position of plots for screen 0
736 % Screen 1 =Size and position of plots for dual monitors
737 % Screen 1 =Size and position of plots for HDMI Out
738 % (1080i)
739 % Position =Plot screen variable
740 % Plots =Toggle to turn plots on(1) or off(0)
205

741 % ----------------------------------------------------------
742 Screen 0=[550,10,800,650];
743 Screen 1=[1400,10,800,650];
744 Screen 2=[1360,-310,1920,1024];
745 Position=Screen 0;
746 Plots=1;
747

748 % -- OFDM parameters ---------------------------------------


749 Nfft=64;
750 M=16;
751 levels=log2(M);
752 Frames=60;
753 Num bins=52;
754 CP=16;
755 gain=1;
756

757 % -- Channel parameters ------------------------------------


758 channel=[1j 0 0 0.2 0 0.06j 0 0 0.01j];
759 CHAN=fftshift(fft(channel,Nfft));
760 noise=0.001*(rand(1,(Frames+2)*(Nfft+CP))+1j*...
761 rand(1,(Frames+2)*(Nfft+CP)));
762

763 % -- OFDM Preamble -----------------------------------------


764 LTS=[zeros(1,6) 1 1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 ...
765 1 1 -1 1 -1 1 1 1 1 0 1 -1 -1 1 1 -1 1 -1 1 -1 -1 ...
766 -1 -1 -1 1 1 -1 -1 1 -1 1 -1 1 1 1 1 zeros(1,5)];
767 LTS IFFT Input=fftshift(LTS);
768 LTS IFFT Output=ifft(LTS IFFT Input);
769 x LTS=[LTS IFFT Output(Nfft-2*CP+1:end)...
770 LTS IFFT Output LTS IFFT Output];
771

772

773 % -- M-QAM Data -------------------------------------------


774 x0 save=[];
775 x1 save=[];
776 x2 save=[];
777 for nn=1:Frames
778 x0=[zeros(1,(Nfft-Num bins)/2)...
779 (floor(levels*rand(1,Num bins/2))-(levels-1)/2)...
780 /((levels-1)/2)+1j*(floor(levels*rand(1,Num bins/2))...
781 -(levels-1)/2)/((levels-1)/2) 0 ...
782 (floor(levels*...
783 rand(1,Num bins/2))-(levels-1)/2)...
784 /((levels-1)/2)+1j*(floor(levels*rand(1,Num bins/2))...
206

785 -(levels-1)/2)/((levels-1)/2) ...


786 zeros(1,(Nfft-Num bins)/2-1)];
787 x0 save=[x0 save x0];
788 x1=gain*ifft(fftshift(x0));
789 x1 save=[x1 save x1];
790 x2=[x1(Nfft-CP+1:end) x1];
791 x2 save=[x2 save x2];
792 end
793 x=[x LTS x2 save];
794

795 % -- Channel -----------------------------------------------


796 y0=filter(channel,1,x);
797 y=y0+noise;
798

799 Noise Power=sum(noise.*conj(noise))/length(noise);


800 Signal Power=sum(y0.*conj(y0))/length(y0);
801 SNR=10*log10(Signal Power/Noise Power)
802 % -- Demodualte --------------------------------------------
803 y1=[];
804 for nn=3:Frames+2
805 reg=y((nn-1)*(Nfft+CP)+1:nn*(Nfft+CP));
806 reg1=reg(CP+1:end);
807 reg2=fftshift(fft(reg1));
808 y1=[y1 reg2([-26:-1 1:26]+Nfft/2+1)];
809 end
810

811 figure('position',Position)
812 plot(y1(),'rx')
813 title('Received Signal With Channel Distortion',...
814 'FontSize',12)
815 grid on
816 xlabel('In-Phase','FontSize',12)
817 ylabel('Quadrature','FontSize',12)
818

819 % -- Channel Estimation ------------------------------------


820 Y 1=fftshift(fft(y(2*CP+1:2*CP+Nfft)));
821 Y 2=fftshift(fft(y(2*CP+Nfft+1:2*(CP+Nfft))));
822 Y 3=(Y 1+Y 2)/2;
823

824 r=[ones(1,6) Y 3(7:32)./LTS(7:32) 1+1j ...


825 Y 3(34:59)./LTS(34:59) ones(1,5)];
826

827 figure('position',Position)
828 plot(-Nfft/2+6:Nfft/2-6,20*log10(real(r(7:59))),'o')
207

829 hold on
830 plot(-Nfft/2+6:Nfft/2-6,20*log10(real([CHAN(7:32) 1+1j ...
831 CHAN(34:59)])) ,'rx')
832 grid on
833 legend('Channel Estimation','Channel Frequency Response')
834 title({['Multipath Channel with SNR=',num2str(SNR)]},...
835 'FontSize',16)
836 xlabel('Frequency bin','FontSize',12)
837 ylabel(' | H[f]|2 [dB]','FontSize',12)
838 % -- Demodulate with channel correction --------------------
839 y1=[];
840 for nn=3:Frames+2
841 reg=y((nn-1)*(Nfft+CP)+1:nn*(Nfft+CP));
842 reg1=reg(CP+1:end);
843 reg2=fftshift(fft(reg1))./r;
844 y1=[y1 reg2([-26:-1 1:26]+Nfft/2+1)];
845 end
846 figure('position',Position)
847 plot(y1(),'rx')
848 title('Received Signal With Channel Correction',...
849 'FontSize',16)
850 grid on
851 xlabel('In-Phase','FontSize',12)
852 ylabel('Quadrature','FontSize',12)
208

APPENDIX F
CORRELATION
209

CORRELATION
For our purposes, the cross-correlation measures the similarity between two comlplex
functions f (t) and g(t). In the case that the two functions are the same, we say
auto-correlation. The cross-correlation is defined as,

f g f(t) g(t), (F.1)

is the complex conjugate operator. For discrete


where is the convolution operator and ()
functions we define the cross-correlation as

f[m]g[m].
X
f g (F.2)
m=

Because convolution is defined as


Z
[f g](t) f( )g(t )d, (F.3)

we can define the cross-correlation as


Z
[f g](t) f( )g(t )d (F.4)

and equivalently Z
[f g](t) f( )g(t + )d. (F.5)

Let f (t) and g(t) be functions such that g = f (t ), is a shifted copy of f (t). The
cross-correlation of f and g essentially slides the function g along the t-axis and sums the
product of the two functions at each interval. The two functions are aligned with each other
when the product is at a maximum since we are essentially squaring the function f at that
point. The reason for taking the conjugate of f is so that the complex product will contribute a
positive quantity to the sum.
210

APPENDIX G
PHASE LOCK LOOP
211

PHASE LOCK LOOP


The phase lock loop (PLL) is a necessary component of a communication system. It
is, at its most basic form, a feedback control system that drives a voltage controlled oscillator
(VCO). Figure G.1 is a block diagram of the basic PLL showing the three fundamental
components: the phase error detector, the loop filter, and the VCO.

Figure G.1. Basic phase lock loop.

The implementation of the PLL for this thesis is shown in figure G.2.

Figure G.2. Phase lock loop.


212
To better understand the phase locked loop, it is helpful to look at a classic dampened
spring mass problem. Suppose we have a mass M , a spring with constant k, viscous damping
coefficient c, and external force F .

Figure G.3. Dampened spring mass system.

This system can be modeled using Newtons second law as the second order
differential equation
F = M x + cx + kx. (G.1)

Taking the Laplace transform yields the following:

F (s) = M s2 X(s) + csX(s) + kX(s) (G.2)


X(s) 1
= 2
. (G.3)
F (s) M s + cs + k

As an example, let M = 1kg, c = 10N s/m, k = 10N/m, and F (s) = 1, then


1
X(s) = (G.4)
s2 + 20s + 10
Figure G.4 shows the undamped system X = 1/(s2 + 10) and figure G.5 shows the damped
system X(s) = 1/(s2 + 10s + 10).
213

Undampend Step Response


0.25

0.2

0.15
Displacment

0.1

0.05

0
0 1 2 3 4 5 6 7 8 9 10
Time [s]

Figure G.4. Undamped system.

For a PLL system, the steady state corresponds to the phase error. We require that the
amount of time to reach steady state to be small. To accomplish this we introduce the
proportional gain kp to the system

X(s) kp
= . (G.5)
F (s) M s2 + cs + (k + kp )

Figure G.6 shows the output of the PLL with the proportional gain kp = 300
214

Open Loop Step Response

0.1
Displacment

0.05

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time [s]

Figure G.5. Damped system.


215

Closed Loop Step Response With Proportional Control


1.5

1
Displacment

0.5

0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time [s]

Figure G.6. Proportional control.

We can see that the proportional control helps the system rise quicker and attain
steady state in less time but increases the overshoot. We next add the integral control to the
system
X(s) ki
= (G.6)
F (s) M s + cs2 + k + ki
3

Figure G.7 shows the step response of the system with the added integral control
ki = 5.
216

Closed Loop Step Response With Integral Control


2

1.8

1.6

1.4

1.2
Displacment

0.8

0.6

0.4

0.2

0
0 5 10 15 20 25 30 35 40 45 50
Time [s]

Figure G.7. Integral control.

Notice that the rise time also decreases and overshoot increases but the time to settle
also increases. The advantage in using integral control is the elimination of error. The settling
time can be decreased but at the expense of rise time.
Combining proportional and integral control gives

X(s) kp s + k1
= 3 2
(G.7)
F (s) M s + cs + (k + kp )s + ki

Using the following parameters, the step response is shown in figure G.8

M =1 (G.8)
c = 10 (G.9)
k = 10 (G.10)
217

kp = 30 (G.11)
k1 = 70 (G.12)

Closed Loop Step Response With Proportional and Integral Control


1.2

0.8
Displacment

0.6

0.4

0.2

0
0 0.5 1 1.5 2 2.5 3
Time [s]

Figure G.8. Proportional and integral control.

Notice that the quick rise is still retained, the overshoot is decreased and the error is
eliminated. To remove the overshoot, a derivative control can be added but this will increase
the complexity and is not necessary.
We now derive the equations that describe the PLL using the proportional integral
control. Let out be the phase of the PLL output and in the input phase. Then
out (s + kd kv F (s)) = in (kd kv F (s)) (G.13)
out kd kv F (s)
= , (G.14)
in s + kd kv F (s)
218

where kd is the phase detector gain, kv is the VCO gain, and F (s) is the loop filter transfer
function. The loop filter can be described by a low pass filter
1
F (s) = , (G.15)
1 + sRC
so that
k k
d v
out
= 1+sRCkd kv
(G.16)
in s + 1+sRC
kd kv
= 2
(G.17)
s + s RC + kd kv
kd kv
RC
= . (G.18)
s2 + s
RC
+ kRC
d kv

This has the same form as the harmonic oscillator previously discussed and therefore,
can be related to the second order system
wn2
H(s) = , (G.19)
s2 + 2swn + wn2
where is the dampening ratio and wn is the undamped angular frequency of the oscillator.
For the purposes of this paper, the PLL of interest has transfer function
 
(kp + ki ) z kpk+kp
i
H(z) =   , (G.20)
z 2 2 1 kp +k
2
i
z + (1 kp )
where the numerator is the lead forward path and the denominator is the lag path. Using
Tustins method
2 1 z 1
s (G.21)
TS 1 + z 1
or equivalently
1 Ts z + 1
, (G.22)
s 2 z1
where Ts is the sampling time with equation G.19 we have that
wn2 s12
H(s) = (G.23)
1 + 2wn 1s + wn2 s12
2 z+1 2
wn2 T2s z1
H(z) = 2 z+1 2 (G.24)
Ts z+1
1 + 2wn 2 z1 + wn2 T2s

z1
z+1 2
n2 z1

Ts
= 2 , with n = wn (G.25)
z+1
+ n2 z+1 2
 
1 + 2n z1 z1
..
.

4n ( + n ) z +n
= 2 . (G.26)
1 + 2n + n2 z 2 2 1+n
2 z + 12n +n
2
1+2n +n 1+2n +n
219
Comparing equation G.20 with equation G.26, we obtain

4n ( + n )
kp + ki = (G.27)
1 + 2n + n2
1 2n + n2
1 kp = (G.28)
1 2n + n2
1 kp + ki 1 + n2
= . (G.29)
2 1 + 2n + n2
Hence
4n
kp = (G.30)
1 + 2n + n2
42
ki = (G.31)
1 + 2n + n2
Ts
n = w n , (G.32)
2
where kp , ki , and n are the proportional control, integral control, and digital undamped
natural frequency respectively.
As an example, let the first 100 samples of input to a PLL be 0.05 and the second 100

samples be 0.1 with = 2/2, n = 1/25 as shown in figure G.9.
220

Input Phases
15

10
Accumulated Phase

0
0 20 40 60 80 100 120 140 160 180 200
Sample Number

Figure G.9. Input to PLL.

Figure G.10 shows the input and output phases to the PLL, as well as the output of the
loop filter and the phase detector.
221

Input and Output Phases


20
Accumulated Phase Input Phase
15 Output Phase

10

0
0 20 40 60 80 100 120 140 160 180 200
Sample Number
Output of Loop Filter, DDS Control Frequency
0.2

0.15
Phase

0.1

0.05

0
0 20 40 60 80 100 120 140 160 180 200
Samlple Number
Phase Error, Output of ATAN (Phase Detector)
0.6

0.4
Error

0.2

0.2
0 20 40 60 80 100 120 140 160 180 200
Sample Number

Figure G.10. Input and output phases to PLL, loop filter, and phase detector.

Figure G.11 shows the real and imaginary parts of the input and output signal. Notice
that the system acquires a phase lock in about 60 samples which, for IEEE 802.11a
transmission standards is about 3s, well within the one OFDM frame.
222

Real Part of Input and Output Signals


1.5 Input Signal
Output Signal
1
Magnitude

0.5

0.5

1
0 20 40 60 80 100 120 140 160 180 200
Sample Number

Imaginary Part of Input and Output Signals


1.5 Input Signal
Output Signal
1
Magnitude

0.5

0.5

1
0 20 40 60 80 100 120 140 160 180 200
Sample Number

Figure G.11. PLL input and output time series.


223

APPENDIX H
MATLAB CODE FOR PLL
224

MATLAB CODE FOR PLL

2 %% -- PLLtutorial.m ----------------------------------------
3 % MATLAB Thesis Simulation
4 % Steven Hemple
5 %
6 % This MATLAB script explores the phase lock loop
7 % ----------------------------------------------------------
8 clear all;
9 close all;
10 clc;
11

12 % -- Simulation Parameters ---------------------------------


13 %
14 % Screen 0 =Size and position of plots for screen 0
15 % Screen 1 =Size and position of plots for dual monitors
16 % Screen 1 =Size and position of plots for HDMI Out
17 % (1080i)
18 % Position =Plot screen variable
19 % Plots =Toggle to turn plots on(1) or off(0)
20 % ----------------------------------------------------------
21 Screen 0=[550,10,800,650];
22 Screen 1=[1400,10,800,650];
23 Screen 2=[1360,-310,1920,1024];
24 Position=Screen 0;
25 Plots=1;
26

27 %% -- Parameters -------------------------------------------
28 %
29 %
30 % ----------------------------------------------------------
31 M=1;
32 C=10;
33 K=10;
34 Kp=[300 0 60];
35 Ki=60;
36 t=0:0.01:50;
37
225

38 figure('name',...
39 'Thesis Phase Lock Loop Simulation- Undampend open Loop System',...
40 'position',Position)
41 num=1;
42 den=[M 0 K];
43 [x]=step(num,den,t);
44 plot(t,x')
45 title('Undampend Step Response','FontSize',16)
46 xlabel('Time [s]','FontSize',12);
47 ylabel('Displacment','FontSize',12);
48 axis([0 10 0 0.25]);
49 grid on
50

51

52 figure('name',...
53 'Thesis Phase Lock Loop Simulation- Dampend open Loop System',...
54 'position',Position)
55 num=1;
56 den=[M C K];
57 [x]=step (num,den,t);
58 plot(t,x')
59 title('Open Loop Step Response','FontSize',16)
60 xlabel('Time [s]','FontSize',12);
61 ylabel('Displacment','FontSize',12);
62 axis([0 5 0 0.15])
63 grid on
64

65 figure('name',...
66 'Thesis Phase Lock Loop Simulation- Closed With ...
67 Loop System Proportional Control ',...
68 'position',Position)
69 num=[Kp(1)];
70 den=[M C (K+Kp(1))];
71 [x]=step (num,den,t);
72 plot(t,x')
73 title('Closed Loop Step Response With Proportional Control'...
74 ,'FontSize',16)
75 xlabel('Time [s]','FontSize',12);
76 ylabel('Displacment','FontSize',12);
77 axis([0 5 0 1.5])
78 grid on
79

80 figure('name',...
81 'Thesis Phase Lock Loop Simulation- Closed With ...
226

82 Loop System Integral Control ',...


83 'position',Position)
84 num=[Kp(2) Ki];
85 den=[M C (K+Kp(2)) Ki];
86 [x]=step (num,den,t);
87 plot(t,x')
88 title('Closed Loop Step Response With Integral Control',...
89 'FontSize',16)
90 xlabel('Time [s]','FontSize',12);
91 ylabel('Displacment','FontSize',12);
92 axis([0 50 0 2])
93 grid on
94

95

96 figure('name',...
97 'Thesis Phase Lock Loop Simulation- Closed With ...
98 Loop System Proportional an Integral Control ',...
99 'position',Position)
100 num=[Kp(3) Ki];
101 den=[M C (K+Kp(3)) Ki];
102 [x]=step (num,den,t);
103 plot(t,x')
104 title('Closed Loop Step Response With Proportional and ...
105 Integral Control','FontSize',16)
106 xlabel('Time [s]','FontSize',12);
107 ylabel('Displacment','FontSize',12);
108 axis([0 3 0 1.25])
109 grid on
110

111

112 %% -- Phase Lock Loop Simulation ---------------------------


113

114 % ----------------------------------------------------------
115 % Parameters
116 %
117 % theta 0 = Digital undamped natural frequency, theta 0=w 0 *T/2
118 % eta= Dampening factor
119 % k i= Integreal gain
120 % k p= Proportional gain
121 % ----------------------------------------------------------
122 theta 0=1/25;
123 eta=sqrt(2)/2;
124 k i=(4*theta 0 *theta 0)/(1+2*eta*theta 0+theta 0 *theta 0);
125 k p=(4*eta*theta 0)/(1+2*eta* theta 0+theta 0*theta 0);
227

126

127 % ----------------------------------------------------------
128 % Input
129 %
130 % dph 1= The input frequency for the first 100 samples.
131 % dph 1= The input frequency for hte second 100 samples.
132 % dph= The input frrequencies.
133 % ph 1= Output of first phase accumulator. Use filter
134 % 1/(1-z-1) for delay.
135 % s 1= The output of the DDS.
136 % ph 2 save= Angles from output of bottom phase accumulator
137 % int 1 save= Output of k i path
138 % dph save
139 % ----------------------------------------------------------
140 sim num 1=100;
141 sim num 2=100;
142 sim num=sim num 1+sim num 2;
143

144 dph 1=0.05; % Input phase


145 dph 2=0.1; % Input phase
146 dph=[dph 1 *ones(1,sim num 1) dph 2 *ones(1,sim num 2)];
147

148 ph=filter(1,[1 -1],dph); % Output of Phase accumulator


149 s 1=exp(1j*2*pi*ph); % Output of DDS (Top path)
150

151 ph 2 save=zeros(1,sim num);


152 int 1 save=zeros(1,sim num);
153 dph save=zeros(1,sim num);
154

155 int 1=0;


156 int 2=0;
157

158 %% ---------------------------------------------------------
159 % Simulation
160 % ----------------------------------------------------------
161 for n=1:length(ph) % Loop for number of input samples
162 prod=s 1(n)*exp(-1j*2*pi* int 2); % Product of two DDS
163 phi(n)=angle(prod)/(2*pi); % Output of ATAN
164

165 % ------------------------------------------------------
166 % Loop Filter
167 % ------------------------------------------------------
168 int 1=int 1+k i *phi(n); % Output of k i path
169 dph=k p *phi(n)+int 1; % Output of sum of k i and k p
228

170 dph save(n)=dph; % Save output of loop filter


171

172 % ------------------------------------------------------
173 % DDS
174 % ------------------------------------------------------
175 ph 2 save(n)=int 2; % Save previous output of phse acum
176 int 2=int 2+dph; % Next input to phase accumulator
177 end
178

179 figure('name',...
180 'Thesis Phase Lock Loop Simulation- Phase Locked Loop',...
181 'position',Position)
182 plot(1:length(ph),ph)% Input phase
183 grid on
184 title('Input Phases','FontSize',16)
185 ylabel('Accumulated Phase','FontSize',12)
186 xlabel('Sample Number','FontSize',12)
187

188 figure('name',...
189 'Thesis Phase Lock Loop Simulation- Phase Locked Loop',...
190 'position',Position)
191 subplot(3,1,1)
192 plot(1:length(ph),ph)% Input phase
193 hold on
194 plot(1:length(ph),ph 2 save,'r') % Output phase
195 hold off
196 grid on
197 title('Input and Output Phases','FontSize',16)
198 ylabel('Accumulated Phase','FontSize',12)
199 xlabel('Sample Number','FontSize',12)
200 legend('Input Phase','Output Phase','Location','SouthEast',...
201 'FontSize,',12);
202

203

204 subplot(3,1,2)
205 plot(1:length(ph),dph save)
206 hold on
207 plot([0 sim num 1],[dph 1 dph 1],'--r')
208 plot([sim num 1 sim num],[dph 2 dph 2],'--r')
209 grid on
210 title('Output of Loop Filter, DDS Control Frequency',...
211 'FontSize',16)
212 ylabel('Phase','FontSize',12)
213 xlabel('Samlple Number','FontSize',12);
229

214

215 subplot(3,1,3)
216 plot(1:sim num,ph-ph 2 save)
217 title('Phase Error, Output of ATAN (Phase Detector)',...
218 'FontSize',16);
219 xlabel('Sample Number','FontSize',12);
220 ylabel('Error','FontSize',12);
221 grid on;
222

223 figure('name',...
224 'Thesis Phase Lock Loop Simulation- Phase Locked Loop',...
225 'position',Position)
226 subplot(2,1,1)
227 plot(real(s 1),'linewidth',1)
228 hold on
229 plot(cos(2*pi* ph 2 save),'r','linewidth',1)
230 grid on
231 title('Real Part of Input and Output Signals','FontSize',16)
232 xlabel('Sample Number','FontSize',12)
233 ylabel('Magnitude','FontSize',12)
234 legend('Input Signal','Output Signal','FontSize',12)
235 ylim([-1.1 1.7])
236

237 subplot(2,1,2)
238 plot(imag(s 1),'linewidth',1)
239 hold on
240 plot(sin(2*pi* ph 2 save),'r','linewidth',1)
241 grid on
242 title('Imaginary Part of Input and Output Signals',...
243 'FontSize',16)
244 xlabel('Sample Number','FontSize',12)
245 ylabel('Magnitude','FontSize',12)
246 legend('Input Signal','Output Signal','FontSize',12)
247 ylim([-1.1 1.7])

You might also like