EEE8077 Simulation of WirelessCommunications
Dr. Charalampos C. Tsimenidis
Newcastle UniversitySchool of Electrical and Electronic Engineering
October 2013
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 1 / 78
Motivation
Performance evaluation of wireless communicationsystems:
Theoretical or analytical approach (desired solution),
Semi-analytical approach (alternative solution),
Simulation-based approach (practical solution).
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 2 / 78
Example: Theoretical Performance
Bit-error rate (BER) performance of Binary Shift Keying(BPSK) modulation in Rayleigh fading in the presenceAdditive White Gaussian Noise (AWGN) channel.
System Model:
dn
hn wn
xn = hndn + wn
wherehn are the complex-valued Rayleigh fadingcoefficients with variance 2σ2
h,dn =±1 are the BPSK symbols,wn are the complex-valued AWGN samples.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 3 / 78
Theoretical Performance (Cont.)
Theoretical BER (closed-form solution):
Pe(Γ) =12
(
1−√
Γ1+Γ
)
where
Γ is the average signal to noise ratio (SNR) given as
Γ =Eb
N02σ2
h
Eb is the bit energy
N0 and σ2w are the noise energy and variance
N0 = 2σ2w
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 4 / 78
Theoretical Performance (Cont.)
−5 0 10 20 30 40 5010
−6
10−5
10−4
10−3
10−2
10−1
100
Pe(Γ) =12
(
1−√
Γ
1+Γ
)
Pe(γ) = Q(√
2γ)
Average SNR Γ (dB)
Pe
BPSK in AWGNBPSK in Rayleigh
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 5 / 78
Theoretical Performance (Cont.)
1 %--BPSK in AWGN--2 gamma_dB=-4:0.1:10;3 gamma_lin=10.ˆ(gamma_dB/10);4 ber_AWGN=qfunc( sqrt (2 * gamma_lin));5
6 %--BPSK in Rayleigh--7 Gamma_dB=-4:0.1:40;8 Gamma_lin=10.ˆ(Gamma_dB/10);9 ber_Rayleigh=0.5 * (1- sqrt (Gamma_lin./(Gamma_lin
+1)));10
11 % Plot results12 semilogy (gamma_dB,ber_AWGN,’r-’,...13 Gamma_dB,ber_Rayleigh,’b--’);
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 6 / 78
Semi-analytical Performance
Semi-analytical BER with N sufficiently large:
Pe(γ) =1N
N
∑n=1
Q
(√
2γ |hn|2)
Average effect of hn on γ.
BER in AWGN is given as
Pe(γ) = Q(√
2γ)
γ is the signal to noise ratio given as
γ =Eb
N0
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 7 / 78
Semi-analytical Performance (Cont.)
−5 0 10 20 30 40 5010
−6
10−5
10−4
10−3
10−2
10−1
100
Pe(γ) =1N
N∑
n=1
Q(
√
2γ |hn|2)
Pe(γ) = Q(√
2γ)
Average SNR Γ (dB)
Pe
BPSK in AWGNBPSK in RayleighSemi−analytical
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 8 / 78
Semi-analytical Performance (Cont.)
1 N=1e6;2 gamma_dB_2=-5:5:45;3 gamma_lin=10.ˆ(gamma_dB_2/10);4 L=length (gamma_dB_2);5 ber_Semi_Rayleigh= zeros (1,L);6 for i=1:L7 h=1/ sqrt (2) * ( randn (1,N)+1j * randn (1,N));8 Pe=qfunc( sqrt (2 * gamma_lin(i) * abs (h).ˆ2));9 ber_Semi_Rayleigh(i)= sum(Pe)/N;
10 end
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 9 / 78
Simulated Performance
Implement system using:
Transmitter by generating bn and mapping it to dn
Channel by generating hn and wn and computing fordifferent SNR values
xn = hndn+wn
Receiver by implementing decision rule and BERcomputation.
Display simulation results.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 10 / 78
Simulated Performance (Cont.)
dn
hn wn
xn = hndn + wn
Tx RxComm.
Transmitter Receiver
BER
Channel
Compute
BPSK
Estimated DataData
Pe = f(SNR)
b̂nbn
hn, wn
dn xn
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 11 / 78
Simulated Performance (Cont.)
−5 0 10 20 30 40 5010
−6
10−5
10−4
10−3
10−2
10−1
100
Pe(Γ) =12
(
1−√
Γ
1+Γ
)
Pe(γ) = Q(√
2γ)
Average SNR Γ (dB)
Pe
BPSK in AWGNBPSK in RayleighSimulation
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 12 / 78
Digital Modulation
Digital information is transmitted by varying theinformation of either amplitude a(t), frequency fi(t) orphase φ(t) of a sinusoid:
s(t) = a(t)sin[2π fi(t)t +φ(t)]
Modulation types:Amplitude Shift Keying (ASK):a(t) conveys information, while fi(t) and φ(t) constant.Frequency Shift Keying (FSK):fi(t) conveys information, while a(t) and φ(t) constant.Phase-shift keying (PSK):φ(t) conveys information, while a(t) and fi(t) constant.Quadrature Amplitude Modulation (QAM):Two parameters are varied, i.e. amplitude a(t) andphase φ(t).
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 13 / 78
Bandpass and Complex-Baseband Signals
The information bearing signal is referred to as thecomplex-baseband or lowpass equivalent signal,sl (t), given as
sl (t) = a(t)ejφ(t) = xI (t)+ jxQ(t)
Bandpass signal is only required to reduce theeffective antenna size required. It is given as
s(t) = Re{sl(t)ej2π fct}
= Re{[xI (t)+ jxQ(t)]ej2π fct}= xI (t)cos(2π fct)−xQ(t)sin(2π fct)
sl (t) is much lower frequency (typically ≤ 20MHz)than s(t) which can be up to 60GHz.Thus, it is computationally inefficient to include thecarrier in the simulations.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 14 / 78
Bandpass and Complex-Baseband Signals(Cont.)
The entire system is simulated in most cases at thesymbol rate to minimize simulation times.The symbol-rate, sampled complex-baseband signalis given as
sl (nT) = a(nT)ejφ(nT) = xI (nT)+ jxQ(nT)
In simulations, we only need xI (nT) and xQ(nT) ora(nT) and φ(nT), with T being the symbol duration,which can be also dropped for clarity.System/signal bandwidth and sampling frequency areonly required for normalizing the times of multipatharrivals and for Doppler effect simulations intime-varying systems
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 15 / 78
Typical Program Structure
1 % Short description of simulation2 clear , clc , close all3
4 % Simulation parameter definitions5 M=16; % Constellation size6 ...7
8 % Reset BER variable9 BER=zeros (1,?);
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 16 / 78
Typical Program Structure (Cont.)
1 for m=... % SNR loop2 total_errors=0;3 for n=... % Averaging loop4 % Transmitter5 ...6 % Communications channel7 ...8 % Receiver9 ...
10 % Bit error computation11 new_errors=...12 total_errors=total_errors+new_errors;13 end14 BER=...15 end
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 17 / 78
Typical Program Structure (Cont.)
1 % Plot results2 semilogy (?,?)3 ...4
5 % Store results in a file6 save ...
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 18 / 78
16-Point Quadrature Amplitude Modulation(16-QAM)
The theoretical bandwidth efficiency is 4 bit/s/Hz
k = 4 bits are grouped to create a symbol
Constellation consists of M = 2kbits = 24 = 16 points
M-QAM alphabet: {±(2k−1)d± j(2k−1)d}, wherek∈ {1, . . .
√M2 }
For 16-QAM, with M = 16 and k = 4 we obtain 4values for the I and Q channel, i.e.
I , Q∈ {−3d,−d, d, 3d}
d is an arbitrary value, typically d = 1 or d = 13
This corresponds to 2 bits per channel.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 19 / 78
Constellation of Binary-Coded 16-QAM
1 C=[-3+3j, -3+1j,2 -3-1j, -3-3j,3 -1+3j, -1+1j,4 -1-1j, -1-3j,5 1+3j, 1+1j,6 1-1j, 1-3j,7 3+1j, 3+1j,8 3-1j, 3-3j];
−4 −3 −2 −1 0 1 2 3 4−4
−3
−2
−1
0
1
2
3
40000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
In−phase
Qua
drat
ure
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 20 / 78
Constellation of Gray-Coded 16-QAM
1 C=[-3+3j, -3+1j,2 -3-3j, -3-1j,3 -1+3j, -1+1j,4 -1-3j, -1-1j,5 3+3j, 3+1j,6 3-3j, 3-1j,7 1+3j, 1+1j,8 1-3j, 1-1j];
−4 −3 −2 −1 0 1 2 3 4−4
−3
−2
−1
0
1
2
3
40000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
In−phase
Qua
drat
ure
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 21 / 78
Constellation of Gray-Coded 16-QAM (Cont.)
For a constellation point z= x+ jy, the bit allocation,b0b1b2b3, is as follows
First bit, b0
b0 = 0 if Re{z} ≤ 0b0 = 1 if Re{z}> 0
Second bit, b1
b1 = 0 if Re{z} ≤ −2 or Re{z} ≥ 2b1 = 1 if Re{z}>−2 or Re{z} < 2
Third bit, b2
b2 = 0 if Im{z} ≥ 0b2 = 1 if Im{z}< 0
Forth bit, b3
b3 = 0 if Im{z} ≤ −2 or Im{z} ≥ 2b3 = 1 if Im{z}>−2 or Im{z} < 2
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 22 / 78
MATLAB Implementation for 16 QAM Tx
By writing our own code using look-up table:
D(k) = C(bk +1)
where C is the constellation vector and sk is thesymbol index, e.g. k = 0,1,2, ...,M−1.
To generate bk use: randi(?,?,?)
Help: >> doc randi
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 23 / 78
Random Number Generation
MATLAB by default generates always the samerandom numbers at the start of each session.
To obtain different random values in differentMATLAB sessions include at the top of your code,right after clear , the following:
1 RN=sum(100 * clock );2 RS=RandStream(’mt19937ar’,’seed’,RN);3 RandStream.setGlobalStream(RS);
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 24 / 78
Code Developement Lab 2
Develop a 16-QAM modulator using look-up tableapproach to generate a frame of 2048 16-QAMsymbols.Add complex-valued random AWGN noise with smallstandard deviation (e.g. 0.25) and plot the resultingconstellation.
−4 −3 −2 −1 0 1 2 3 4−4
−3
−2
−1
0
1
2
3
4
In−phase
Qua
drat
ure
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 25 / 78
Time-Frequency Relationship
The time-bandwidth product is defined as: BT = 1
The Fourier spectrum of a rectangular pulse
pT(t) = Arect(tT
)FT←→ PT( f ) = ATsinc( f T)
where the sinc( .) function defined as: sinc(x) = sin(πx)x
T
4
T−8 −7 −6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6 7 80
0.25
0.5
0.75
1
f (Hz)
PT(f)
TT4
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 26 / 78
Principle of OFDM
B ChannelFrequen yResponseSingle CarrierMulti Carrier
f∆f =B
N
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 27 / 78
Advantages of OFDM
Efficient spectrum usage.
Resilience to frequency selective multipath channels.
Simplified receiver design: FFT + one-tap equalizer.
Less sensitive to symbol timing and impulsive noise.
Bit and power loading at subcarrier level possible.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 28 / 78
Disadvantages of OFDM
OFDM signal exhibits high Peak-to-Average PowerRatio (PAPR).
Very sensitive to carrier frequency offsets (CFO).
Very sensitive to intercarrier interference (ICI) due toFFT leakage.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 29 / 78
OFDM Transmitter Model
SymbolOFDM
S/P16−QAM
Insert Pilots
Modulator IFFT P/SSymbols16−QAM
Insert
PrefixCyclic
[0, 1, . . . , 15] x(n)
d(n)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 30 / 78
OFDM Signal Model
Definitions:
d[n] =1√N
N−1
∑k=0
D[k]ej 2πknN , n = 0,1, . . . ,N−1
D̂[k] =1√N
N−1
∑n=0
d[n]e− j 2πknN , k = 0,1, . . . ,N−1
D[n] is the 16-QAM modulated data sequence +Pilots 1+ j.
N is the length of the IDFT / DFT transform.
n is the time sample index of the transmitted OFDMsymbol.
k is the subcarrier index in frequency domain.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 31 / 78
MATLAB Implementation
d[n] =1N
N−1
∑k=0
D[k]ej 2πknN , n = 0,1, . . . ,N−1
1 d=ifft (D);
D̂[k] =N−1
∑n=0
d[n]e− j 2πknN , k = 0,1, . . . ,N−1
1 D_est= fft (d);
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 32 / 78
MATLAB Implementation (Cont.)
IDFT vs IFFT and DFT vs FFT
If N is a power of 2, MATLAB employs FFT, otherwisea slower DFT is used.
ifft () and fft () accept a second a argument tospecify the transform size and use zero-padding.
No need to zero-pad manually.
Useful oversampling of the channel impulseresponse, h(k) in order to obtain the correctfrequency response H(n).
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 33 / 78
Oversampling Effect (Channel Estimation,PAPR)
1 H=fft (h,Nfft);
0 5 10 15 20 25 320
0.5
1
1.5
a) Without oversampling.
|d[n
]|
0 50 100 150 200 2560
0.05
0.1
0.15
0.2
b) With oversampling by 8.
|d[n
]|
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 34 / 78
Addition of Cyclic Prefix
CP CPOFDM Symbol
Copy last K samples1 d=ifft (D);2 x=[d(?:?) d];
K is the cyclic prefix length added to reduce multipatheffects.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 35 / 78
Cyclic Prefix (Cont.)
DFT Property: replication in one domain correspondsto interpolation in the other.
Thus, if a signal is replicated by M in time domain, itsDFT is zero interpolated by M(and scaled).
The use of CP converts a frequency selectivechannel into a set of parallel flat-fading independentchannels.
Some papers suggest alternatively zero-padding (ZP)instead of CP.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 36 / 78
Energy Normalization
Asymmetric energy transform implementation withrespect to time-frequency domain transition.
Problem with required noise power computation forgiven SNR.Signal energy normalization required.Implementation:
either by multiplying x with√
N before addingGaussian noise,or by scaling the noise standard deviationappropriately by 1/
√N.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 37 / 78
Code Developement Lab 3
Develop the code to implement
The 16-QAM OFDM transmitter,
insertion of K-sample cyclic-prefix usingconcatenation,
Energy normalization of the OFDM waveform.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 38 / 78
Channel Simulation
y(n) = x(n) + w(n)
w(n)
x(n)
Complex additive Gaussian noise:
1 w=sigma(?) * ( randn (?,?)+1j * randn (?,?))
randn() generates zero-mean unity variance noisesamples.
Appropriate scaling using the standard deviationsigma(?) is required.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 39 / 78
Gaussian Probability Density Function (PDF)
Models the statistics of thermal noise in receiversknown as additive white Gaussian noise (AWGN).Appears in closed-form BER solutions for theperformance over AWGN channels.The PDF of a Gaussian distribution is defined as
fw(x) =1√
2πσwe− (x−µw)2
2σ2w
where µw is the mean value and σ2w is the variance.
σw is called the standard deviation.It is also referred to as normal, N .To indicate that a random variable w has a Gaussianor normal pdf fw(x), we write
w→N (µw,σ2w)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 40 / 78
Gaussian pdf
−4 −3 −2 −1 0 1 2 3 40
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
x
fw(x)
∫∞−∞ fw(x)dx = 1
µw = 0, σ2w = 1µw = 0, σ2w = 0.5µw = 0, σ2w = 0.25µw = 1, σ2w = 1µw = −1, σ2w = 1
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 41 / 78
Gaussian Cumulative Density Function(CDF)
In general, the CDF is defined as
Fw(x) = P(w≤ x) =
Z x
−∞fw(u)du
CDF propertiesFw(x)≥ 0, ∀x
Fw(−∞) = 0, Fw(∞) = 1
The CDF of a Gaussian distribution is given as
Fw(x) =12
+12
erf
(x−µw√
2σw
)
=12− 1
2erfc
(x−µw√
2σw
)
= 1−Q
(x−µx
σw
)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 42 / 78
Gaussian CDF and PDF
−4 −3 −2 −1 0 1 2 3 40
0.5
1
1.5
x
fw(x),Fw(x)
Gaussian cdf and pdf for µw = 0,σ2w = 1
Fw(−∞) = 0
Fw(∞) = 1
fw(x)Fw(x)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 43 / 78
The erf(x), erfc(x) and Q(x) Functions
The error function
erf(x) =2√π
Z x
0e−t2
dt
The complementary error function
erfc(x) =2√π
Z ∞
xe−t2
dt
Relationship: erfc(x) = 1−erf(x)
The Q( .) function:
Q(x) =1√2π
Z ∞
xe−t2
2 dt
Relationship between Q(x) and erfc(x):
Q(x) =12
erfc
(x√2
)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 44 / 78
SNR Computation
The SNR is computed as follows:
SNR=Eb
N0
The average bit energy Eb computed from theconstellation:
Eb =Es
log2(M)
The noise energy is computed as:
N0 = 2σ2w
We need to solve for σw =√
. . .
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 45 / 78
Es Computation
Es is computed as follows:
Es =1M
M−1
∑n=0|cn|2
=116
(4|3d+ j3d|2+8|3d+ jd|2+4|d+ jd|2
)
=116
(72d2+80d2+8d2)=
16016
d2
= 10d2
Reminder complex numbers: z∈C
z= a+ jb⇒ |z|2 =(√
a2+b2)2
= a2+b2
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 46 / 78
16-QAM BER in AWGN
For M = 2 (2-QAM/BPSK) and M = 4 (4-QAM/QPSK):
Pb = Q
(√2Eb
N0
)
For M >> 4, k = log2(M)
Pb =PM
k
wherePM ≈ 1− (1−P√M)2
with
P√M = 2
(
1− 1√M
)
Q
(√
3kM−1
Eb
N0
)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 47 / 78
16-QAM BER in AWGN (Cont.)
0 2 4 6 8 10 12 14 1610
−6
10−5
10−4
10−3
10−2
10−1
100
Pe(γ) = Q(√
2γ)
γ = Eb
N0(dB)
Pe
BPSK in AWGN16−QAM in AWGN
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 48 / 78
Code Developement Lab 4
Develop MATLAB code that
Computes the standard deviation for 16-QAM inAWGN, for a given SNR value given in dB.
Generates random AWGN noise wn scaled by thecorrect σw and adds it to the OFDM signal.
Generates the BER vs Eb/N0 plots for BPSK and16-QAM in AWGN.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 49 / 78
Receiver Structure for AWGN
16−QAMSymbolsRemove
S/P FFTOFDMReceived
SymbolCyclicPrefix
P/SDemodul.
16−QAM
CP is discarded at the receiver to avoid interblockinterference.
DFT/FFT is performed.
Channel estimation is not required for AWGNchannel.
16-QAM demodulation using custom code.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 50 / 78
Demodulator Input Signal
−5 −4 −3 −2 −1 0 1 2 3 4 5−5
−4
−3
−2
−1
0
1
2
3
4
5
In−phase
Qua
drat
ure
γ = Eb
N0= 16 dB
−5 −4 −3 −2 −1 0 1 2 3 4 5−5
−4
−3
−2
−1
0
1
2
3
4
5
In−phase
Qua
drat
ure
γ = Eb
N0= 6 dB
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 51 / 78
16-QAM Demodulator
Decision metric:
b̂k = argi
min(|Ci− D̂k|), i = 0,1 . . . ,M−1, M = 16
where |Ci− D̂k| is the Euclidean distance defined as
|Ci− D̂k|=√[Re(Ci)−Re(D̂k)
]2+[Im(Ci)− Im(D̂k)
]2
Re{C}Im{C}
C7
C2
C3
C6
C1
C0 C4
C5
C8
C9
C12
C10
C11
C13
C15
C14
D̂k
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 52 / 78
Displaying Information about Simulation
1 str= sprintf (’SNR=%0.1f,BER=%0.6f\n’,10.5,0.1);2 disp (str);3
4 SNR=10.5,BER=0.100000
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 53 / 78
Measuring Simulation Time
1 tic2 ...3 toc4
5 % or6 t_start= cputime ;7 ...8 cputime -t_start9
10 % or (not recommended)11 t_start = clock ;12
13 etime ( clock , t_start)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 54 / 78
Parallel Configuration
(Menu) Parallel −→ Manage Cluster Profiles
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 55 / 78
Parallel Computing with parfor
1 % Start default worker pool using2 matlabpool open3 %...4
5 % Outer loop6 parfor m=...7
8 end9
10 % Close worker pool11 matlabpool close
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 56 / 78
Code Developement Lab 5
Develop MATLAB code that
Removes the CP and computes the FFT of thereceived noisy signal.
Estimates using the minimum Euclidean distance thetransmitted 16-QAM symbols.
Computes and displays the BER vs. SNRperformance by averaging P-times per SNR point.
Displays information about simulation during codeexecution.
Measures the total simulation time elapsed.
Simulates the performance using the parallelconfiguration.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 57 / 78
Multipath Channel Scenario
Mobile Station (MS)
Reflector Cluster
Base Station (BS)
Impulse ResponseSingle Reflector
τ21τ22
τ32
τ1
τ31
τ4τ3τ2τ1
τi = τi1 + τi2 i = 2, 3, 4
τ41 τ42
τ
a1e−j2πfcτ1
a2e−j2πfcτ2
a3e−j2πfcτ3
a4e−j2πfcτ4
h(τ ; t)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 58 / 78
Channel Impulse Response (CIR)
The complex-baseband impulse response of thechannel is given
h(τ; t) =L
∑l=1
al(t)e− jφl (t)δ(t− τl(t))
The phase shifts are φl(t) are proportional to thecorresponding time delays τl(t), that is
φl (t) = 2π fcτl(t)
where fc is the carrier frequency.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 59 / 78
Simplified CIRs
Constant arrival times:
τl (t) = τl
h(τ, t) =L
∑l=1
al (t)e− jφl(t)δ(t− τl )
Static multipath:
τl(t) = τl , al (t) = al , φl (t) = φl
h(τ) =L
∑l=1
ale− jφl δ(t− τl )
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 60 / 78
Multipath Channel Implementation
Multipath channel treated as linear time-invariantsystem:
Multipath Channel
w(n)
x(n)h(n)
y(n) z(n) = y(n) + w(n) = h(n) ∗ x(n) + w(n)
Discrete convolution (filtering):
y(n) = h(n)∗x(n) =∞
∑m=−∞
h′(m)x(n−m)
If x(n) ∈ C1×N and h(n) ∈ C1×L then length ofy(n) ∈C1×M is
M = N+L−1
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 61 / 78
Multipath Channel Implementation (Cont.)
Preferred MATLAB Implementation:
1 % Initial filter state2 zf=[];3 ...4 % Multipath channel5 [y,zf]= filter (h,1,x,zf);6 z=y+w; % Add WGN
This implementation keeps track of the channel statebetween OFDM symbols.
Interblock interference can be simulated.
Documentation: >>doc filter
In general, y=conv(h,x)+w; can be utilized, but notas useful.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 62 / 78
ITU Channel for Mobile WiMAX
Multipath magnitudes hi need to be obtained fromP = [0 -0.9 -4.9 -8.0 -7.8 -23.9];
Appropriate zero-padding is required between thepaths.
0 5 18 27 52 84−25
−20
−15
−10
−5
0
Delay spread (Samples)
P(dB)
ITU Pedestrian B Ch. 103
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 63 / 78
Channel Normalization
The channel magnitudes are obtained as
hi =
√
10Pi10
Channel profile needs to be normalized to unityenergy
L
∑i=1|hi|2 = 1
If {hi}Li=1 are the unnormalized channel coefficientsthen in order to normalize we use:
U =
√L
∑i=1|hi|2
hi =hi
U, i = 1, 2, 3, . . . , L
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 64 / 78
Theoretical Performance in Multipath forBPSK
Identical to semi-analytical BER since channel is static.For BPSK that is
Pe(γ) =1N
N
∑n=1
Q
(√
2γ |Hn|2)
whereHn is the frequency response of the ITU channel.N is here the FFT length.The frequency response is obtained applying the FFTon the vector {hi}Li=1 by oversampling by N.γ is the signal to noise ratio given as
γ =Eb
N0
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 65 / 78
Theoretical Performance in Multipath for16QAM
For 16QAM, with M = 16, k = log2(M) = 4, that is
P√M = 2
(
1− 1√M
)1N
N
∑n=1
Q
(√
3kM−1
Eb
N0|Hn|2
)
withPM ≃ 1− (1−P√M)2
andPb≃
PM
k
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 66 / 78
Code Developement Lab 6-7
Develop MATLAB code that with regard to the ITUmultipath channel:
Implements and normalizes its impulse response.
Filters the OFDM signal through the channel andadds complex-valued AWGN noise for a given SNRvalue in dB.
Computes and displays its frequency response.
Computes and displays the theoretical BER vs.Eb/N0 performance for BPSK and 16-QAM throughthis channel.
Computes and displays the simulated BER vs. Eb/N0
performance for 16-QAM through this channel usinga receiver without equalizer.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 67 / 78
Generic Receiver Structure
16−QAMSymbolsRemove
S/P P/SFFT16−QAMOne−tap
Equalizer Demodul.OFDM
ReceivedCyclicPrefixSymbol
CP is discarded at the receiver to avoid interblockinterference.DFT/FFT is performed.One-tap per subcarrier zero-forcing design to removechannel effect.Channel estimation: impulse response known orunknown.16-QAM demodulation using custom code (samecode as in AWGN case).
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 68 / 78
Mathematical Model of the Received Signal
The received signal at the FFT output can be given as
Y(k) = D(k)H(k)+W(k), k = 0,1,2, ...N−1
To remove the channel effects, we need to divide Y(k)by the complex-valued channel coefficient, H(k), ofthe channel frequency response.Thus, the decision variable becomes
D̂(k) = D(k)+W(k)H(k)︸ ︷︷ ︸
W̃(k)
, k = 0,1,2, ...N−1
The noise term W̃(k) is no longer Gaussian.Noise enhancement occurs if channel frequencyresponse exhibits spectral nulls.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 69 / 78
Equalizer for Known Channel
We assume h(n) is perfectly known.H(k) is derived from the impulse response h(n) viaDFT/FFT.Oversampling of H(k) is required to match the lengthof an OFDM symbol.
1 N=2048;2 ...3 H=fft (h,N);
Detection variable after CP removal, FFT and zeroforcing:
D̂(k) =Y(k)H(k)
= D(k)+W̃(k), k = 0,1,2, ...N−1
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 70 / 78
Code Developement Lab 8-9
Develop MATLAB code that
Computes the zero-forcing equalizer coefficients(computation is required only once as the channel istime-invariant).
Implements the modified 16-QAM receiver usingone-tap equalizer.
Computes and displays the simulated BER vs Eb/N0
performance.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 71 / 78
Equalizer for Unknown Channel
Insert 1 pilot for every 8 subcarriers at the transmitter:
−1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 180
0.2
0.4
0.6
0.8
1
|Hest(k)|
subcarrier index, n
DataPilotsEstimates
Estimate unknown channel at pilot indices H(p).
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 72 / 78
Linear Interpolation
Interpolate to obtain in-between channel values.Line equations connecting two points:
y−y1
y2−y1=
x−x1
x2−x1
y
x2x1
y1
y2
x
n n + L
m m + 1n (OFDM index)
Hp(m + 1)
Hp(m)
m (Pilot index)Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 73 / 78
Linear Interpolation (Cont.)
Interpolation equation:
Hest(k) = Hp(m)+lL[Hp(m+1)−Hp(m)]
Indices:m= 1,2, . . . ,Np−1,
l = 1,2, . . . ,L−1,
k = (m−1)L+ l +1
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 74 / 78
Linear Interpolation (Cont.)
For the data subcarriers after the Npth pilot we needto extrapolate the equation from the last two pilots,e.g. Hp(Np−1) and Hp(Np) and l = l +L.
extrapolate
Np − 1 Np m (Pilot index)n (OFDM index)
Hest(n)
N
Hp(Np − 1)
Hp(Np)
L (Np − 2) L (Np − 1)
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 75 / 78
Estimated Frequency Response
0 500 1000 1500 20000
0.5
1
1.5
2
2.5
subcarrier index
|H(k
)|,|H
est(k
)|
|H(k) ||Hest(k) |
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 76 / 78
Equalizer for Unknown Channel
Zero forcing equalizer:
D̂(k) =Y(k)
Hest(k), k = 0,1,2, ...N−1, k 6= m
BER should not be computed at the pilot locations,e.g. k = m
Total number of bits should be adjusted to account forthe pilot overhead.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 77 / 78
Code Developement Lab 10-12
Develop MATLAB code that
Estimates the frequency response of the multipathchannel using pilots and computes the zero-forcingequalizer coefficients.
Implements the modified 16-QAM receiver usingone-tap equalizer and channel estimation.
Computes and displays the BER vs Eb/N0
performance with channel estimation.
Computes the mean-squared error as the function ofSNR in dB between the estimated and actualfrequency response of the channel.
Dr. Charalampos C. Tsimenidis EEE8077 Simulation of Wireless Communications 78 / 78
Top Related