OFDM Simulation EE810
OFDM Simulation EE810
OFDM Simulation EE810
N
N1
k=0
X[k]e
j
2n(kN/2)
N
, 0 n N 1, (1)
X[k]
1
N
N1
n=0
x[n]e
j
2n(kN/2)
N
, 0 k N 1. (2)
It is pointed out that the above equations can also be eciently computed by Matlab
IFFT and FFT commands. First, the FFT and IFFT in Matlab are dened exactly
the same as that in the Lecture Notes, namely:
X[k] = FFT{x[n]} =
N1
n=0
x[n]e
j
2nk
N
, 0 k N 1, (3)
x[n] = IFFT{X[k]} =
1
N
N1
k=0
X[k]e
j
2nk
N
, 0 n N 1. (4)
It follows that (1) and (2) can be computed with the above standard IFFT/FFT as:
x[n] =
N IFFT{X[k]} e
jn
, 0 n N 1,
X[k] =
1
N
FFT{x[n] e
jn
}, 0 n N 1.
N_CP: This is the length of cyclic prex (CP), measured in the number of time samples.
The use of cyclic prex to overcome the eect of ISI is explained in the Lecture Notes.
For upstream transmission, there are 11 possible values for the CP length (see Table
7-2 on pages 3839). The choice depends on the delay spread of the channel and it is
required that N_CP L_CH, where L_CH is the length of the equivalent discrete-time
channel (explained later).
N_RP: In addition to CP extension, windowing is also applied to the time samples
before transmission. The purpose of windowing is to maximize channel capacity by
sharpening the edges of the spectrum of the OFDMA signal. This windowing operation
is specic to DOCSIS 3.1 standard and not explained in the Lecture Notes. You should
review Section 7.4.11 of the standard carefully to understand how it is done.
Electrical & Computer Engineering, University of Saskatchewan Page 2
EE810Communication Theory I (Fall 2013) Project
It is pointed out that there is a typo in the equation of the windowing function on
page 64. The correct expression for the right half of the window is:
w
_
N + N
CP
+ N
RP
2
+ i
_
= (5)
_
1.0, i = 0, 1, . . . ,
N+N
CP
N
RP
2
1
1
2
_
1 sin
_
N
RP
_
i
N+N
CP
2
+
1
2
_
__
, i =
N+N
CP
N
RP
2
, . . . ,
N+N
CP
+N
RP
2
1.
Also the roll-o parameter of the windowing function is dened as =
N
RP
N+N
CP
. Note
that this parameter is frequently referred to in many places of the Standard document.
Mod_type: Type of QAM-modulation, raging from BPSK to 16,384-QAM (see Table
A-1 on page 197).
Sub_chan: This is a row vector that species the sub-channels to be used. For example,
if N_FFT = 2048, then Sub_chan = [20:230] means that among 2048 sub-channels,
only 211 contiguous sub-channels, from 20 to 230, are used.
L_bst: The number of OFDM blocks over which the channel coecients stay the same
(i.e., the coherence time of the channel).
N_Sim: The total number of OFDM blocks to be simulated.
b_orig: Sequence of randomly-generated information bits.
tx: Sequence of time-domain OFDM samples to be transmitted.
Channel:
L_CH: This species the length of the equivalent discrete-time multipath channel. Re-
ferring to Fig. 6 of Lecture Notes, the value of this parameter is the same as + 1.
Moreover, in this part of the project, the channel is modeled and simulated as mul-
tipath Rayleigh fading.
1
Specically, the channel coecients h[n], n = 0, . . . , , are
generated as independent complex Gaussian random variables. The real and imagi-
nary parts of h[n] are zero-mean i.i.d. real Gaussian random variables with variance
2
n
2
, where the variance of the nth tap has an exponential taper (also known as channel
delay prole) given by:
E{|h[n]|
2
} =
2
n
= e
n/(+1)
, 0 n (6)
where is a scaling factor such that
n=0
2
n
= 1.
imp_ch: This vectors contains the channel coecients as simulated above. The infor-
mation of this vector is made available at the OFDM receiver for detection (i.e., perfect
channel estimation is assumed).
1
Although multipath Rayleigh fading is a common channel model in mobile wireless communications, it
is not applicable for DOCSIS channel. Channel modeling for DOCSIS will be explained at a later date.
Electrical & Computer Engineering, University of Saskatchewan Page 3
EE810Communication Theory I (Fall 2013) Project
SNR: This signal-to-noise parameter sets the variance of complex AWGN component
at the output of the equivalent discrete-time channel. Specically, let w[n] denote the
noise component at the output of the channel illustrated in Fig. 6 of the Lecture Notes.
Then one has
y[n] = x[n] h[n] + w[n], (7)
where w[n] is modeled as a zero-mean complex Gaussian random variable, whose real
and imaginary components have variance
2
w
/2 each. The SNR is dened as
2
SNR = 10 log
10
E{|X[n]|
2
}
2
w
(dB), (8)
where E{|X[n]|
2
} is the average symbol energy of the employed QAM constellation.
Receiver:
b_dec: This vector contains the detected bits. It can be compared to b_orig to
determines the BER.
2.2 Requirements
You should make your Matlab scripts as general as possible, i.e., they should work with any
specic parameters as specied in DOCSIS 3.1. To verify that your Matlab scripts work
properly, in addition to submitting your Matlab scripts via email, please obtain and submit
a gure that plots the BER curves over the SNR range of [0 : 2 : 24] dB and for the following
modulation formats: BPSK, QPSK, 8-QAM and 16-QAM (you need to follow page 187 in
Appendix A of the standard). The parameters used for obtaining such a gure are as follows:
N_FFT = 256; % use this FFT size to speed up the simulation
N_CP = 96;
N_RP = 32;
Sub_chan = [20:230];
L_CH = 8;
L_bst = 1;
N_Sim = 1000;
Remarks:
Interaction with other fellow students on the concepts and expectations of this project
are encouraged but you should write your own Matlab scripts and submit them indi-
vidually. You might want to get together as a group to see if there are any common
questions/concerns and then schedule a meeting with me to answer those questions.
The due date for Part I is January 24, at 3:00PM.
When emailing your Matlab les, please compress them in one folder and name it as
EE810_YourFirstName_YourLastName.zip (rar format is ne as well).
2
This is only one denition of SNR and it is chosen to facilitate performance comparison in Part II with
results reported in [1].
Electrical & Computer Engineering, University of Saskatchewan Page 4
EE810Communication Theory I (Fall 2013) Project
3 Part II
In Section I you simulated an ideal OFDM system where no frequency and timing errors
are present. This Section examines the important issues of timing and frequency errors in a
more practical OFDM system. The eects of timing and frequency errors are rst discussed.
Then techniques to perform coarse timing and frequency estimations are introduced. The
material in this section follows closely the excellent tutorial paper by Morelli et. al [1].
3.1 Theory
In keeping with the notations in [1], dene the length of the equivalent complex baseband
channel to be L and the length of the cyclic prex to be N
g
. The length-L vector of the
channel impulse response (CIR) is denoted as h = (h[0], h[1], . . . h[L 1])
. The channel
frequency response over the kth subcarrier is dened in [1] as H[k] =
L1
l=0
h[l]e
j
2lk
N
. With
the modied DFT/IDFT denitions used in DOCSIS 3.1, H[k] can be redened as
H[k] =
L1
l=0
h[l]e
j
2l(kN/2)
N
, 0 k N 1. (9)
It is simple to show that, with the above denition, E{|H[k]|
2
} =
L1
l=0
E{|h[l]|
2
}, k.
In addition, the discussion in this section does not include the time-windowing operation
specied in DOCSIS 3.1. The phrase OFDM block refers to a group of N + N
g
time-
domain samples after the IFFT and CP extension. To avoid interference between adjacent
transmitted OFDM blocks, called inter-block interference (IBI), one needs to ensure that
N
g
L 1.
The ith OFDM block after CP extension has length N
T
= N+N
g
and can be represented
as:
x
i
= ( x
i
[N
g
iN
T
], x
i
[N
g
+1 iN
T
], . . . , x
i
[N 1 +iN
T
])
, i = . . . , 1, 0, 1, . . . (10)
Considering the transmission of multiple OFDM blocks, the channels output for a perfectly-
synchronized OFDM system is written as:
y[n] =
i
L1
k=0
h[k] x
i
[n k iN
T
] + w[n] (11)
In practical situations oscillator instabilities results in a frequency oset, f
d
, between
the received carrier and the local sinusoids used for signal demodulation. In addition, at the
start-up the receiver does not know where the OFDM blocks start and, accordingly, the DFT
window may be placed in a wrong position. This results in a timing error, denoted by
d
,
which must be properly compensated to avoid severe performance degradation. Since small
(fractional) timing errors can be corrected through channel equalization, it suces to locate
the beginning of each received OFDM block within one sampling period. For this reason,
it is a common practice to model the timing error as an integer multiple of the sampling
period, denoted by . The remaining fractional timing error is considered as part of the CIR.
Electrical & Computer Engineering, University of Saskatchewan Page 5
EE810Communication Theory I (Fall 2013) Project
In summary, let = Nf
d
T
s
be the frequency oset normalized to the subcarrier spacing
of 1/(NT
s
), the received samples in the presence of synchronization errors has the following
form:
y[n] = e
j2n/N
i
L1
k=0
h[k] x
i
[n k iN
T
] + w[n] (12)
Fig. 1 shows the block diagram of a practical OFDM receiver. The coarse frequency and
timing estimation units employ the received sequence y[n] to compute estimates of and ,
denoted by and
, respectively. The estimate is used to counter-rotate y[n] at an angular
speed 2/N (coarse frequency correction), while the time estimate
is exploited to achieve
the correct positioning of the receive DFT window (coarse timing correction). Specically,
the counter-rotated samples with indexes iN
T
+
n iN
T
+
+ N 1 are grouped
together and passed to the DFT unit.
Coarse
timing
estimation
Coarse
frequency
estimation
Frequency
and timing
correction
Remove
cyclic prefix
Fine
frequency
estimation
DFT
Channel
equaliziation
Channel
estimates
to data
detection
[ ] y n
i
y
i
Y
Figure 1: Block diagram of an OFDM receiver with timing and frequency corrections.
3.1.1 Sensitivity to Timing and Frequency Errors
Eect of Timing Oset
To avoid IBI, the DFT window should include samples from only one single block. As
shown in Fig. 2, the tail of each received OFDM block extends over the rst L 1 samples
of the successive block as a consequence of multipath dispersion. Since the CP length must
be greater than the CIR duration in a well designed system, a certain range of the guard
interval is not aected by the previous block at the receiver. As long as the DFT window
starts anywhere in this range, no IBI is present at the DFT output. This situation occurs
whenever the timing error =
belongs to interval N
g
+L1 0. Such a timing
error only results in a cyclic shift of the received OFDM block. Specically, applying the
time-shift property of the Fourier transform and assuming perfect frequency synchronization
(i.e., = 0), the DFT output over the kth subcarrier takes the form
Y
i
[k] = exp(j2k/N)H[k]X
i
[k] + W
i
[k], 0 k N 1 (13)
Electrical & Computer Engineering, University of Saskatchewan Page 6
EE810Communication Theory I (Fall 2013) Project
The above equation indicates that timing error appears as a linear phase shift across
subcarriers. This phase shift cannot be distinguished from the phase shift introduced by the
channel. As such, the eect can be compensated for by the channel equalizer.
On the other hand, if the timing error is outside interval N
g
+L1 0, samples
at the DFT input will be contributed by two adjacent OFDM blocks. In addition to IBI, this
results in a loss of orthogonality among subcarriers which, in turn, generates inter-carrier
interference (ICI). In this case, the kth DFT output is given by
Y
i
[k] = exp(j2k/N)()H[k]X
i
[k] + I
i
(k, ) + W
i
[k], 0 k N 1, (14)
where () is an attenuation factor, while I
i
(k, ) accounts for IBI and ICI. This term
and can reasonably be modeled as a zero-mean random variable with power
2
I
(). Both
() and
2
I
() depend on the timing error and the channel delay prole as discussed in
[2].
A useful indicator to evaluate the eect of timing errors on the system performance is
the loss in the SNR. This quantity is dened as
() =
SNR
(ideal)
SNR
(real)
(15)
Here, SNR
(ideal)
is the SNR of a perfectly synchronized system as dened in (8), namely
SNR
(ideal)
= E{|X[n]|
2
}/
2
w
. On the other hand, SNR
(real)
is the SNR in the presence
of a timing oset. Since the three terms in the right-hand-side of (14) are statistically
independent, it follows that SNR
(real)
= E{|X[n]|
2
}
2
()/[
2
w
+
2
I
()]. Substituting
these results into (15) yields
() =
1
2
()
_
1 +
2
I
()
2
w
_
(16)
th block i
data CP
( 1)th block i
Transmitted
blocks
g
N
data CP
tail of the
( 1)th block i
Received
blocks
1 L
IBI-free part
of the CP
Figure 2: Partial overlapping between received blocks due to multipath dispersion.
Electrical & Computer Engineering, University of Saskatchewan Page 7
EE810Communication Theory I (Fall 2013) Project
Eect of Frequency Oset
A carrier frequency oset produces a shift of the received signal in the frequency domain
and may result in a loss of orthogonality among subcarriers. To better explain this problem,
lets assume ideal timing synchronization (i.e.,
= ) and compute the DFT output corre-
sponding to the ith OFDM block in the presence of a frequency error . Such a computation
is given in [3] and yields
Y
i
[k] = e
j
i
N1
p=0
H[k]X
i
[k]f
N
( + p k) + W
i
[k] (17)
where
i
= 2iN
T
/N and f
N
(x) is dened as
f
N
(x) =
sin(x)
N sin(x/N)
e
jx(N1)/N
. (18)
Next, it is convenient to distinguish between two distinct situations, depending on whether
the frequency error is an integer multiple of the subcarrier spacing 1/NT
s
. In the rst case,
is an integer value and (17) reduces to
Y
i
[k] = e
j
i
H(|k |
N
)X
i
(|k |
N
) + W
i
[k] (19)
where |k |
N
is the value of k reduced to interval [0, N 1]. The above equation
indicates that an integer frequency oset only results in a shift of subcarriers by positions.
Orthogonality among subcarriers is thus still preserved, even though the received symbols
appear at the wrong positions at the DFT output.
The situation is drastically dierent when is not an integer. In this case, the subcarriers
are no longer orthogonal and (17) can be conveniently rewritten as
Y
i
[k] = e
j
i
H[k]X
i
[k]f
N
() + I
i
(k, ) + W
i
[k] (20)
where I
i
(k, ) is a zero-mean ICI term with power
2
I
() = E{|I
i
(k, )|
2
}. Subsituting
E{|H[k]|
2
} = 1, and after some manipulations one can show that
2
I
() = E{|X[n]|
2
}[1 |f
N
()|
2
]. (21)
Like the impact of timing error, the impact of the frequency error on the system perfor-
mance can be assessed in terms of the SNR loss:
() =
SNR
(ideal)
SNR
(real)
. (22)
Here, as before, SNR
(ideal)
is the SNR of a perfectly-synchronized system, whereas SNR
(real)
=
E{|X[n]|
2
}|f
N
()|
2
/[
2
w
+
2
I
()] is the SNR in the presence of frequency oset . Substituting
these results into (22) and making use of (21), one obtains
() =
1
|f
N
()|
2
_
1 +
E{|X[n]|
2
}
2
w
[1 |f
N
()|
2
]
_
. (23)
Electrical & Computer Engineering, University of Saskatchewan Page 8
EE810Communication Theory I (Fall 2013) Project
A simpler expression of () can be obtained for small values of by using the Taylor
series expansion of |f
N
()|
2
around = 0. This produces
() 1 +
1
3
E{|X[n]|
2
}
2
w
()
2
. (24)
The above equation indicates that the SNR loss is related to the square of the normalized
frequency oset.
Equation (23) is plotted in Fig. 3 as a function of for some values of SNR
(ideal)
=
E{|X[n]|
2
}/
2
w
. These results indicate that non-negligible performance degradations are
incurred when the frequency error exceeds 4%5% of the subcarrier distance.
10
2
10
1
0
1
2
3
4
5
6
7
Normalized frequency error,
)
(
d
B
)
SNR
(ideal)
= 5 dB
SNR
(ideal)
= 10 dB
SNR
(ideal)
= 15 dB
Figure 3: SNR loss due to frequency errors.
3.1.2 Synchronization Algorithms
= argmax
_
|(
)|
_
, (27)
where (
) =
+N/21
q=
y[q + N/2]y
[q]
+N/21
q=
|y[q + N/2]|
2
. (28)
Electrical & Computer Engineering, University of Saskatchewan Page 10
EE810Communication Theory I (Fall 2013) Project
120100 80 60 40 20 0 20 40 60 80 100 120
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
=
T
i
m
i
n
g
m
e
t
r
i
c
,
)
S & C
S & S
Figure 5: Example of timing metrics for S&C and S&S algorithms.
Fig. 5 shows an example of the timing metric (the red curve), |(
=
. The results are obtained numerically over a Rayleigh multipath channel
with L = 8 taps. The number of subcarriers is N = 256 and the CP has length N
g
= 16.
The SNR over received samples is dened as SNR =
2
s
/
2
w
with
2
s
= E{|s
(R)
(k)|
2
} and is
set to 20 dB.
0
( ) y
1
( ) y
2
( ) y
3
( ) y
Sliding window ( samples) N
Time-domain
samples
Figure 6: Sliding window used in S&S timing acquisition scheme.
Unfortunately, it is seen from Fig. 5 that the timing metric of the S&C algorithm exhibits
a large plateau that may greatly reduce the estimation accuracy. Solutions to this problem
were proposed in [5, 6], where reference blocks with suitably-designed patterns are exploited
to obtain sharper timing metric trajectories [5, 6]. For example, Shi and Serpedin (S&S) used
a training block composed of four repetitive parts [+B, +B, B, +B] with a sign inversion
in the third segment [6]. As depicted in Fig. 6, a sliding window of length N spans received
time-domain samples with indexes
n
+ N 1 and collects them into four vectors
y
j
(
) = {y[l + jN/4 +
]; 0 l N/4 1} with j = 0, 1, 2, 3. The timing metric is then
computed as
(
) =
|
1
(
)| + |
2
(
)| + |
3
(
)|
3
2
3
j=0
y
j
(
)
2
(29)
Electrical & Computer Engineering, University of Saskatchewan Page 11
EE810Communication Theory I (Fall 2013) Project
where
1
(
) = y
H
0
(
)y
1
(
) y
H
1
(
)y
2
(
) y
H
2
(
)y
3
(
2
(
) = y
H
1
(
)y
3
(
) y
H
0
(
)y
2
(
3
(
) = y
H
0
(
)y
3
(
).
(30)
Fig. 5 also plots (
) for the S&S algorithm in the same operating conditions. Since the
plateau region present in the S&C metric is now signicantly reduced, more accurate timing
estimates are expected. As indicated in [5], reference blocks with more than four repetitive
segments can be designed to further increase the sharpness of the timing trajectory.
Frequency Acquisition
After frame detection and timing acquisition, the OFDM receiver must compute a coarse
frequency estimate to align its local oscillator to the received carrier frequency. This opera-
tion is referred to as frequency acquisition and is normally accomplished at each new received
frame by exploiting the same reference blocks used for timing acquisition in addition to pos-
sibly other dedicated blocks.
One common approach is to employ a training pattern composed by some repetitive parts
which remain identical after passing through the transmission channel except for a phase
shift produced by the frequency error. The frequency error is then estimated by measuring
the induced phase shift. This method was originally employed by Moose in [3], where the
phase shift between two successive identical blocks is measured in the frequency domain at
the DFT output. More precisely, assume that timing acquisition has already been achieved
and let Y
1
[k] and Y
2
[k] be the kth DFT output corresponding to the two reference blocks.
Then, one may write
Y
1
[k] = S
(R)
[k] + W
1
[k] (31)
Y
2
[k] = S
(R)
[k]e
j2N
T
/N
+ W
2
[k] (32)
where S
(R)
[k] is the signal component (the same over each block as long as the channel
is static), while W
1
[k] and W
2
[k] are noise terms. The above equations indicate that an
estimate of can be computed as
=
1
2(N
T
/N)
arg
_
N1
k=0
Y
2
[k]Y
1
[k]
_
. (33)
The main drawback of the above scheme is the relatively short acquisition range. Since
the arg{} function returns values in the range [, ), it is seen from (33) that | |
N/(2N
T
), which is less than one-half of the subcarrier spacing. A viable method to enlarge
the acquisition range is proposed by Schmidl & Cox in [4]. They decompose the frequency
error into a fractional part, less than 1/(NT
s
) in magnitude, plus an integer part which is a
multiple of 2/(NT
s
). The normalized frequency error is thus rewritten as
= + 2 (34)
where (1, 1] and is an integer. The S&C estimator relies on the transmission of two
suitably designed reference blocks as depicted in Fig. 7. The rst block is the same as that
Electrical & Computer Engineering, University of Saskatchewan Page 12
EE810Communication Theory I (Fall 2013) Project
used for timing acquisition. In particular, it is composed by two identical halves of length
N/2 that are generated by modulating only subcarriers with even indices while setting the
others to zero. The second block contains a dierentially encoded pseudo-noise sequence,
PN1, on even subcarriers and another pseudo-noise sequence, PN2, on odd subcarriers.
first half CP second half
first reference block
(for estimation of )
PN1 and PN2 sequences CP
second reference block
(for estimation of )
Figure 7: Reference blocks used by the S&C algorithm for frequency acquisition.
The samples in the two halves of the rst block are obtained after substituting (34) into
(25) and (26). This yields
y[n] = s
[n]e
j
+ w[n + N/2], n + N/2 1 (36)
where, for notational simplicity, we dene s
[n] = s
(R)
[n]e
j2(+2)n/N
and the identity e
j2
=
1 is also used in the derivation. The above equations indicate that, apart from thermal noise,
the two halves are identical except for a phase shift of . Thus, an estimate of is obtained
as
=
1
arg
_
_
_
+N/21
n=0
y[n + N/2]y
[n]
_
_
_
. (37)
As shown above, timing information is necessary to compute . In practice, in (37) is
replaced by its corresponding estimate
given in (27).
The next step is the estimation of the integer frequency oset . For this purpose, the
samples belonging to the two reference blocks of Fig. 7 are rst counter-rotated at an angular
speed 2 /N to compensate for the fractional oset . Next, they are fed to the DFT unit,
which produces quantities Y
1
[k] and Y
2
[k] for 0 k N 1. As explained before, once the
fractional frequency oset is perfectly compensated, the DFT outputs are not aected by
ICI. However, they will be shifted from their correct position by a quantity 2 due to the
uncompensated integer frequency oset. In fact, from (19) one has
Y
1
[k] = e
j
1
H(|k 2|
N
)X
1
(|k 2|
N
) + W
1
[k] (38)
Y
2
[k] = e
j
2
H(|k 2|
N
)X
2
(|k 2|
N
) + W
2
[k] (39)
where |k2|
N
is the value k2 reduced to interval [0, N1]. Neglecting for simplicity the
noise terms and dening P[k] = X
2
[k]/X
1
[k] to be the dierentially-encoded PN sequence
on the even subcarriers of the second block, it is seen from (38) and (39) that
Y
2
[k] = e
j(
2
1
)
P[|k 2|
N
]Y
1
[k], for even k. (40)
Therefore, an estimate of can be calculated by nding integer that maximizes the fol-
lowing metric:
B( ) =
k even
Y
2
[k]Y
1
[k]P
[|k 2 |
N
]
k even
|Y
2
[k]|
2
(41)
Electrical & Computer Engineering, University of Saskatchewan Page 13
EE810Communication Theory I (Fall 2013) Project
where varies over the range of possible integer frequency osets. With (34), the estimated
CFO is nally obtained in the form = + 2 .
As mentioned before, the main advantage of the S&C method over the Moose scheme is
the enlarged frequency acquisition range. An interesting question is whether a similar result
can be obtained even with a smaller overhead than that required by S&C. A solution in this
sense was proposed by Morelli and Mengali (M&M) in [7]. They consider a single reference
block composed by Q > 2 identical parts, each containing N/Q samples. The estimated
CFO is obtained as
=
1
2/Q
Q/2
q=1
(q) arg{(q)
(q 1)} (42)
where (q) are suitably designed coecients, given by
3
(q) =
12(Qq)(Q q + 1) 3Q
2
2Q(Q
2
1)
(43)
and (q) is the following qN/Q-lag autocorrelation:
(q) =
+N1qN/Q
n=
y[n + qN/Q]y