Post on 15-Oct-2021
EEE8128 Communications and Signal Processing:Part 1, Simulation Techniques
Dr. Charalampos C. Tsimenidis
Newcastle UniversitySchool of Engineering
October 2019
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 1 / 94
Introduction
Aim:The aim of this module is to simulate a wirelesscommunication link.Objectives:The objectives of this module are to
Map the components of a theoretical system model intosoftware (MATLAB).Evaluate the performance under various channel modelsusing theoretical, semi-analytical and simulationapproaches.Efficient and fast software development.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 2 / 94
Coursework Assessment: Software Development (15%)
Software Development and Demonstration (15%):Matlab m-files with comments written for this assignmentshould be submitted electronically on the last teachingday (Friday) of Semester 1 2020 as one zip file stgrp-x,where x is your group number, by email to:
charalampos.tsimenidis@ncl.ac.uk
Break down of marks:The marks are assigned with respect to the developedsoftware code: i.e.
Correctness: software produces the correct results and theresults are the same as those included in the report (30%)Completeness: all objectives of the course work are met(30%)Documentation/comments (30%)Efficiency (10%)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 3 / 94
Coursework Assessment: Report (35%)
One formal assignment report per group is required(minimum of ∼4500 words, 1500 words per student) whichmust be submitted to General Office on the last teachingday (Friday) of Semester 1.As a general guideline, the report should at least include:
Abstract (5%).Short background theory section (10%).Detailed description of your algorithm implementation(30%).Performance results (30%).Discussions, conclusions and reference sections (10%).Complete set of references (10%).Correctly formatted program listing appendix (5%).
Students may submit individual reports or indicate parts ofthe submitted report as their contribution to obtainindividual marks. This will only happen at request and afterprior agreement.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 4 / 94
Time Plan and Module Support
Lab and Lectures: 4hrs per Week (see timetable)Self-directed study whenever cluster available.Textbooks available in Library.Module support on BlackboardPersonal NCL webpage:http://www.staff.ncl.ac.uk/
charalampos.tsimenidis/EEE8128/EEE8128.html
Surgery hour: TBC
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 5 / 94
System Model
Tx RxData Comm. Estimated Data
Transmitter
16−QAM OFDM
Receiver
BER
Channel
Compute
Pe = f(SNR)
0 2 4 6 8 10 12 14
10−6
10−5
10−4
10−3
10−2
10−1
100
Eb
N0(dB)
BER
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 6 / 94
Transmitter Structure and Tasks
Develop MATLAB code to perform:Random information bit generation for an OFDM symbolsize of 2048.Mapping of the information bit sequence to Gray-coded16-QAM constellation.OFDM symbol generation without and withcomb-interleaved pilots.Cyclic prefix insertion: No CP, 16, 32, and 64 samples.Loop for Monte Carlo simulation of the communication linkthat runs for at least 106 16-QAM symbols persignal-to-noise ratio (SNR) point.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 7 / 94
Channel Specifications and Tasks
Two different channels to be implemented:AWGN: SNR = 0-16 dB in steps of 1 dBFrequency selective multipath channel with impulseresponse h(n) and AWGN:
ITU Pedestrian B, Channel 103.SNR: 0-40 dB in steps of 2 dB.
Perfect symbol timing it is assumed.Develop MATLAB code to perform:
Computation of the theoretical standard deviation for theAWGN noise samples.Frequency response of the multipath channel.Channel filtering of the transmitted signal.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 8 / 94
Receiver Structure and Tasks
Develop MATLAB code to perform:FFT and 16-QAM demodulation using the minimumEuclidean distance approach.Zero Forcing equalization with perfect channel knowledge.ZF equalization with channel estimation using a combdistributed pilots, e.g. 1 pilot for every 8 subcarriers.Constellation plots at the output of the equalizer for specificSNR point, e.g. 5, 15 and 25 dB.Performance of mean square error (MSE) of channelestimation, eMSE = E{|H(n)− H(n)|2}, vs. SNR fordifferent cyclic prefix lengths and the two investigatedmultipath channels.BER vs. SNR in dB for the 2 channels and 2 receivers.For the AWGN channel no cyclic prefix is required.For the multipath channel + AWGN the ZF receiver mustbe evaluated with or without channel knowledge and forthe different cyclic prefix lengths.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 9 / 94
References
1 B.P. Lathi and Z. Ding, Modern Digital and AnalogCommunications Systems, 4th Ed., OUP USA, 2013.
2 J.G. Proakis, M. Salehi and G. Bauch , ModernCommunication Systems Using MATLAB, 3rd Ed., NelsonEngineering, 2011.
3 J.G. Proakis and M. Salehi, Digital Communications, 5thEd., McGraw-Hill, 2008.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 10 / 94
Motivation
Performance evaluation of wireless communication systems:Theoretical or analytical approach (desired solution),Semi-analytical approach (alternative solution),Simulation-based approach (practical solution),Full hardware implementation followed by trials (impracticalsolution).
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 11 / 94
Example: Theoretical Performance
Bit-error rate (BER) performance of Binary Phase Shift Keying(BPSK) modulation in Rayleigh fading in the presence AdditiveWhite Gaussian Noise (AWGN) channel.System Model:
h[n] w[n]
Mod.
d[n]b[n] r[n] = h[n]d[n] + w[n]
whereh[n] are the complex-valued Rayleigh fading coefficientswith variance 2σ2
h,d[n] = ±1 are the BPSK symbols,w[n] are the complex-valued AWGN samples.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 12 / 94
Theoretical Performance (Cont.)
Theoretical BER (closed-form solution):
Pe(Γ) =
∫ ∞0
p(x)Q(x)dx =1
2
(1−
√Γ
1 + Γ
)
whereΓ is the average signal to noise ratio (SNR) given as
Γ =EbN0
2σ2h
Eb is the bit energyN0 and σ2
w are the noise energy and variance
N0 = 2σ2w
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 13 / 94
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 AWGN
BPSK in Rayleigh
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 14 / 94
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=(1-sqrt(Gamma_lin./(Gamma_lin+1)))/2;
10
11 % Plot results12 semilogy(gamma_dB,ber_AWGN,’r-’,...13 Gamma_dB,ber_Rayleigh,’b--’);
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 15 / 94
Semi-analytical Performance
Semi-analytical BER with N sufficiently large:
Pe(γ) =1
N
N∑n=1
Q(√
2γ |h[n]|2)
Average effect of hn on γ.BER in AWGN is given as
Pe(γ) = Q(√
2γ)
γ is the signal to noise ratio given as
γ =EbN0
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 16 / 94
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 AWGN
BPSK in Rayleigh
Semi−analytical
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 17 / 94
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 EEE8128 Communications and Signal Processing 18 / 94
Simulated Performance
Simulated system includes implementations of:Transmitter: generates b[n] and maps it to d[n],Channel: generates h[n] and w[n] and computes fordifferent SNR values
r[n] = h[n]d[n] + w[n]
Receiver: implements the decision rule and BERcomputation.
d[n] = Re{h∗[n]r[n]}d[n] ≤ 0 =⇒ b[n] = 1
d[n] > 0 =⇒ b[n] = 0
Visualization: displays probe signals and simulationresults.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 19 / 94
Simulated Performance (Cont.)
h[n] w[n]
Mod.
d[n]b[n] r[n] = h[n]d[n] + w[n]
Tx RxComm.
Receiver
BER
Channel
Compute
Data
BPSKTransmitter
Estimated Data
b[n]d[n]
h[n], w[n]
r[n]b[n]
Pb = f(SNR)
d[n] = Re{h∗[n]r[n]}
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 20 / 94
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 AWGN
BPSK in Rayleigh
Simulation
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 21 / 94
Digital Modulation
Digital information is transmitted by varying the information ofeither amplitude a(t), frequency fi or phase φ(t) of a sinusoid:
s(t) = a(t) sin(
2πfi t+ φ(t))
Modulation types:Amplitude Shift Keying (ASK):a(t) conveys information, while fi and φ(t) constant.Frequency Shift Keying (FSK):fi 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) and phaseφ(t).
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 22 / 94
Bandpass and Complex-Baseband
The information bearing signal is referred to as thecomplex-baseband or lowpass equivalent signal, sl(t),given as
sl(t) = a(t)ejφ(t) = a(t) cos(φ(t)) + ja(t) sin(φ(t))
= xI(t) + jxQ(t)
Bandpass signal is only required to reduce the effectiveantenna 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 ≤ 20 MHz) thans(t), which can be up to 60 GHz.Thus, it is computationally inefficient to include the carrierin the simulations.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 23 / 94
Bandpass and Complex-Baseband (Cont.)
The entire system is simulated in most cases at the symbolrate to minimize simulation times.The symbol-rate, sampled complex-baseband signal isgiven as
sl(nT ) = a(nT )ejφ(nT ) = xI(nT ) + jxQ(nT )
In simulations, we only need xI(nT ) and xQ(nT ) or a(nT )and φ(nT ), with T being the symbol duration, which can bealso dropped for clarity.System/signal bandwidth and sampling frequency are onlyrequired for normalizing the times of multipath arrivals andfor Doppler effect simulations in time-varying systems
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 24 / 94
Typical Program Structure
This template can be downloaded from the website.
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 EEE8128 Communications and Signal Processing 25 / 94
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(m)=...15 end
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 26 / 94
Typical Program Structure (Cont.)
1 % Plot results2 semilogy(?,?)3 ...4
5 % Store results in a file6 save ...
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 27 / 94
16 Quadrature Amplitude Modulation (QAM)
The theoretical bandwidth efficiency is 4 bit/s/Hzζ = 4 bits are grouped to create a symbolConstellation consists of M = 2ζ bits = 24 = 16 pointsM-QAM alphabet: {±(2ζ − 1)d± j(2ζ − 1)d}, whereζ ∈ {1, . . .
√M2 }
For 16-QAM, with M = 16 and ζ = 4 we obtain 4 values forthe 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 EEE8128 Communications and Signal Processing 28 / 94
Binary-Coded 16-QAM Constellation
0 C=[-3+3j,1 -3+1j,2 -3-1j,3 -3-3j,4 -1+3j,5 -1+1j,6 -1-1j,7 -1-3j,8 1+3j,9 1+1j,
10 1-1j,11 1-3j,12 3+3j,13 3+1j,14 3-1j,15 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
Quadrature
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 29 / 94
Gray-Coded 16-QAM Constellation
0 C=[1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 ];
−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
Quadrature
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 30 / 94
Constellation of Gray-Coded 16-QAM (Cont.)
For a constellation point z = x+ jy, the bit allocation, b0b1b2b3,is as follows
First bit, b0b0 = 0 if Re{z} ≤ 0b0 = 1 if Re{z} > 0
Second bit, b1b1 = 0 if Re{z} ≤ −2 or Re{z} ≥ 2b1 = 1 if Re{z} > −2 or Re{z} < 2
Third bit, b2b2 = 0 if Im{z} ≥ 0b2 = 1 if Im{z} < 0
Forth bit, b3b3 = 0 if Im{z} ≤ −2 or Im{z} ≥ 2b3 = 1 if Im{z} > −2 or Im{z} < 2
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 31 / 94
MATLAB Implementation for 16 QAM Tx
By writing our own code using the look-up table approach:
D[k] = C(b[k] + 1
)where
C is the constellation vector,k = 0, 1, 2, ..., N − 1 is the subcarrier index, andb[k] = {0, 1, . . .M − 1}.
To generate b[k] use: randi(?,?,?)To obtain help: >> doc randi
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 32 / 94
Random Number Generation
MATLAB by default generates always the same randomnumbers at the start of each session.To obtain different random values in different MATLABsessions 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 EEE8128 Communications and Signal Processing 33 / 94
Code Developement Lab 2
Develop a 16-QAM modulator using look-up tableapproach to generate a frame of 2048 16-QAM symbols.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
Quadrature
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 34 / 94
Time-Frequency Relationship
The time-bandwidth product is defined as: B T = 1
The Fourier spectrum of a rectangular pulse
gT (t) = A rect(t
T)
FT←→ GT (f) = AT sinc (f T )
where the sinc( .) function defined as: sinc (x) = sin(πx)x
T
4
Tf (Hz)
-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8
GT(f)
0
0.25
0.5
0.75
1
TT4
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 35 / 94
Principle of OFDM
B
Channel
Frequen y
Response
Single Carrier
Multi Carrier
f∆f =B
N
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 36 / 94
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 EEE8128 Communications and Signal Processing 37 / 94
Disadvantages of OFDM
OFDM signal exhibits high Peak-to-Average Power Ratio(PAPR).Very sensitive to carrier frequency offsets (CFO).Very sensitive to intercarrier interference (ICI) due to FFTleakage.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 38 / 94
OFDM Transmitter Model
Symbol
OFDM
S/P
Insert Pilots
IFFT P/SModulator
16−QAM
Insert
CyclicPrefix
Symbols
16−QAM
x[n]D[n] d[n]b[n]
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 39 / 94
OFDM Signal Model
Definitions:
d[n] =1√N
N−1∑k=0
D[k]ej2πknN , n = 0, 1, . . . , N − 1
D[k] =1√N
N−1∑n=0
d[n]e−j2πknN , k = 0, 1, . . . , N − 1
D[k] is the 16-QAM modulated data sequence + Pilots3 + 3j.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 EEE8128 Communications and Signal Processing 40 / 94
MATLAB Implementation of IFFT and FFT
IFFT equation (transmitter):
d[n] =1
N
N−1∑k=0
D[k]ej2πknN , n = 0, 1, . . . , N − 1
MATLAB implementation:
1 d=ifft(D);
FFT equation (receiver):
D[k] =
N−1∑n=0
d[n]e−j2πknN , k = 0, 1, . . . , N − 1
MATLAB implementation:
1 D_est=fft(d);
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 41 / 94
MATLAB Implementation (Cont.)
IDFT vs IFFT and DFT vs FFTIf N is a power of 2, MATLAB employs FFT, otherwise aslower DFT is used.ifft() and fft() accept a second a argument to specifythe transform size and use zero-padding.Useful oversampling of the channel impulse response, h(k)in order to obtain the correct frequency response H(n).No need to zero-pad manually.You can write your own code for IDFT/IDFT: two for loopsfor k and n.IFFT/FFT implementation more difficult.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 42 / 94
Addition of Cyclic Prefix
CP CPOFDM Symbol
Copy last K samples
1 d=ifft(D);2 x=[d(?:?) d];
K is the cyclic prefix length added to reduce multipatheffects.The use of CP converts a frequency selective channel intoa set of parallel flat-fading independent channels.Alternatively zero-padding (ZP) can be used instead of CP.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 43 / 94
Signal Energy Normalization
Matlab implementation utilizes an asymmetric energytransform implementation with respect to time-frequencydomain transition.Problem with required noise power computation for a givenSNR.Signal energy normalization required.Solution:
either by multiplying x with√N before adding Gaussian
noise,or by scaling the noise standard deviation appropriately by1/√N .
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 44 / 94
Code Developement Lab 3
Develop the code to implementThe 16-QAM OFDM transmitter,Insertion of K-sample cyclic-prefix using concatenation,Energy normalization of the OFDM waveform.Original signal recovery by removing CP and applyinginverse transform.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 45 / 94
Channel Simulation
w(n)
x[n] r[n] = x[n] + w[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 EEE8128 Communications and Signal Processing 46 / 94
Gaussian Probability Density Function (PDF)
Models the statistics of thermal noise in receivers knownas additive white Gaussian noise (AWGN).Appears in closed-form BER solutions for the performanceover 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 Gaussian ornormal pdf fw(x), we write
w → N (µw, σ2w)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 47 / 94
Gaussian pdf
−4 −3 −2 −1 0 1 2 3 4
0
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 EEE8128 Communications and Signal Processing 48 / 94
Gaussian Cumulative Density Function (CDF)
In general, the CDF is defined as
Fw(x) = P (w ≤ x) =
∫ x
−∞fw(u)du
CDF propertiesFw(x) ≥ 0, ∀x
Fw(−∞) = 0, Fw(∞) = 1
The CDF of a Gaussian distribution is given as
Fw(x) =1
2+
1
2erf
(x− µw√
2σw
)=
1
2− 1
2erfc
(x− µw√
2σw
)= 1−Q
(x− µxσw
)Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 49 / 94
Gaussian CDF and PDF
−4 −3 −2 −1 0 1 2 3 4
0
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 EEE8128 Communications and Signal Processing 50 / 94
The erf(x), erfc(x) and Q(x) Functions
The error function
erf(x) =2√π
∫ x
0e−t
2dt
The complementary error function
erfc(x) =2√π
∫ ∞x
e−t2dt
Relationship: erfc(x) = 1− erf(x)
The Q( .) function:
Q(x) =1√2π
∫ ∞x
e−t22 dt
Relationship between Q(x) and erfc(x):
Q(x) =1
2erfc
(x√2
)Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 51 / 94
Example: BPSK in AWGN
w[n]
d[n]Mod.
x[n] = d[n] + w[n]b[n]
0 → +11 → −1
Assuming equi-probable d[n] symbols, their PDF is given as
pd(χ) =1
2δ(χ−
√Eb) +
1
2δ(χ+
√Eb)
The PDF of w[n] is given as
pw(χ) =1√
2πσwe− x2
2σ2w
The PDF of x[n] is then given as
px(χ) =1
2
1√2πσw
e− (χ+
√Eb)
2
2σ2w +1
2
1√2πσw
e− (χ−
√Eb)
2
2σ2w
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 52 / 94
Example: BPSK in AWGN (cont.)
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
0
0.5
1
1.5
2
The probability of a correct decision is given as
Pc = P{x[n] ≤ 0|b[n] = 1} = F (0) = 1−Q(
0− (−√Eb)σw
)Thus, the probability for a wrong decision is
Pe = Pb = 1− Pc = 1− 1 +Q
(√Ebσw
)= Q
(√Ebσw
)Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 53 / 94
Example: BPSK in AWGN (cont.)
With N0 = 2σ2w, we can write√Ebσw
=
√Eb√N0/2
=
√2EbN0
=√
2γb
Thus, with Pe = Pb, the probability of a bit error for BPSK isgiven as
Pb = Q(√
2γb
)or in terms of the complementary error function
Pb =1
2erfc (
√γb)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 54 / 94
SNR Computation
The SNR, γ, per bit is computed as follows:
γb =EbN0
The average energy per bit, Eb, is computed from thesymbol energy, Es, as:
Eb =Es
log2(M)
The noise energy is computed as:
N0 = 2σ2w
We need to solve for σw =√. . .
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 55 / 94
Es Computation
Es is computed from the 16-QAM constellation as follows:
Es =1
M
M−1∑m=0
|C[m]|2 =?
Reminder complex numbers: z ∈ C
z = a+ jb⇒ |z|2 =(√
a2 + b2)2
= a2 + b2
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 56 / 94
16-QAM BER in AWGN
For M = 2 (2-QAM/BPSK) and M = 4 (4-QAM/QPSK):
Pb = Q
(√2EbN0
)
For M >> 4, ζ = log2(M)
Pb =PMζ
wherePM ≈ 1− (1− P√M )2
with
P√M = 2
(1− 1√
M
)Q
(√3ζ
M − 1
EbN0
)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 57 / 94
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
BPSK in AWGN
16-QAM in AWGN
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 58 / 94
Code Developement Lab 4
Develop MATLAB code thatComputes the standard deviation, σw of thecomplex-valued AWGN samples for 16-QAM in AWGN, fora given SNR value in dB.Generates random AWGN noise wn scaled by the correctσw and adds it to the OFDM signal.Generates the BER vs Eb/N0 plots for BPSK and 16-QAMin AWGN.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 59 / 94
Receiver Structure for AWGN
16−QAM
SymbolsRemoveS/P FFTOFDM
Received
Symbol
CyclicPrefix
P/SDemodul.
16−QAM
CP is discarded at the receiver to avoid interblockinterference.DFT/FFT is performed.Channel estimation is not required for the AWGN channel.16-QAM demodulation using the minimum Euclideandistance approach, implemented via custom MATLABcode.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 60 / 94
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
Quadrature
γ =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
Quadrature
γ =Eb
N0
= 6 dB
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 61 / 94
16-QAM Demodulator
Decision metric:
bk = argi
min(|Ci − Dk|), i = 0, 1 . . . ,M − 1, M = 16
where |Ci − Dk| is the Euclidean distance defined as
|Ci − Dk| =√[
Re(Ci)− Re(Dk)]2
+[Im(Ci)− Im(Dk)
]2
Re{C}
Im{C}
C7
C2
C3
C6
C1
C0 C4
C5
C8
C9
C12
C10
C11
C13
C15
C14
Dk
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 62 / 94
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 EEE8128 Communications and Signal Processing 63 / 94
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 EEE8128 Communications and Signal Processing 64 / 94
Parallel Computing with parfor
Use parfor for the outer loop only.Iterations will be distributed on the CPU cores (workers)available.The first time parfor is called may take some time.
1 % Outer SNR loop2 parfor m=...3
4 ...5
6 end
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 65 / 94
Code Developement Lab 5
Develop MATLAB code thatRemoves the CP and computes the FFT of the receivednoisy signal.Estimates using the minimum Euclidean distance thetransmitted 16-QAM symbols.Computes and displays the BER vs. SNR performance byaveraging Navg-times per SNR point.Displays information about simulation during codeexecution.Measures the total simulation time elapsed.Simulates the performance using the parallel configuration.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 66 / 94
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 EEE8128 Communications and Signal Processing 67 / 94
Channel Impulse Response (CIR)
The complex-baseband impulse response of the channel isgiven as
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) + θ(t)
where fc is the carrier frequency and θ(t) is a randomphase component.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 68 / 94
Simplified CIR Models
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, θ(t) = 0
h(τ) =
L∑l=1
ale−jφlδ(t− τl)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 69 / 94
Multipath Channel Implementation
Multipath channel treated as linear time-invariant system:Multipath Channel
x[n] y[n]
w[n]
h[n]r[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 of y[n] ∈ C1×M
isM = N + L− 1
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 70 / 94
FIR-Based Multipath Channel Model
z−1x[n− 1]x[n]
y[n]
hL−1hL−2h1h0
x[n− L− 2]z−1
x[n− L− 1]
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 71 / 94
MATLAB Implementation
Preferred MATLAB Implementation:
1 % Initial filter state2 zf=[];3 ...4 % Multipath channel5 [?,?]=filter(?,?,?,?);6 r=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 not asuseful.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 72 / 94
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 the paths.
l, Normalized Delay spread0 2 9 14 26 42
P[l](dB)
-25
-20
-15
-10
-5
0ITU Pedestrian B Ch. 103
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 73 / 94
Channel Energy Normalization
The channel magnitudes are obtained as
h[l] =
√10
P [l]10
Channel profile needs to be normalized to unity energy
L∑l=0
|h[l]|2 = 1
If {h[l]}Ll=0 are the unnormalized channel coefficients thenin order to normalize we use:
U =
√√√√ L∑l=0
|h[l]|2
h[l] =h[l]
U, l = 0, 1, 2, . . . , L− 1
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 74 / 94
Performance of BPSK in Multipath
Identical to semi-analytical BER performance since channel isstatic. For BPSK that is
Pb(γb) =1
N
N−1∑k=0
Q(√
2γb |H[k]|2)
whereγb = Eb
N0is the signal to noise ratio per bit.
N is the number of OFDM subcarriers.k = 0, 1, . . . , N − 1 is the subcarrier index.The frequency response of the channel, H[k], is obtainedfrom {h[l]}Ll=1 as
H[k] =
L∑l=0
h[l]e−j2πlkN
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 75 / 94
BER Performance of 16-QAM in Multipath
For 16-QAM, with M = 16, ζ = log2(M) = 4, that is
Pb 'PMζ
withPM ' 1− (1− P√M )2
and
P√M = 2
(1− 1√
M
)1
N
N−1∑k=0
Q
(√3ζ
M − 1γb |H[k]|2
)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 76 / 94
Code Developement Lab 6-7
Develop MATLAB code with regard to the ITU multipathchannel that:
Implements and normalizes its impulse response.Filters the OFDM signal through the channel and addscomplex-valued AWGN noise for a given SNR value in dB.Computes and displays its frequency response. Note: usethe oversampling property of FFT to obtain the frequencyresponse for N subcarriers.Computes and displays the theoretical BER vs. Eb/N0
performance for BPSK and 16-QAM through this channel.Computes and displays the simulated BER vs. Eb/N0
performance for 16-QAM through this channel using areceiver without equalizer.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 77 / 94
Expected Performance Results
0 5 10 15 20 25 3010
−5
10−4
10−3
10−2
10−1
100
Eb
N0(dB)
Pb
BPSK AWGN
BPSK MP
16−QAM AWGN (Theory)
16−QAM MF AWGN (Sim.)
16−QAM MP (Semi.)
16−QAM MF MP (Sim.)
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 78 / 94
Generic Receiver Structure
16−QAM
SymbolsRemoveS/P P/SFFT
16−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 or unknown.16-QAM demodulation using custom code (same code asin AWGN case).
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 79 / 94
Effect of Cyclic Prefix
Reminder: the OFDM signal can be written as
d = FHD
where D ∈ CN×1 are the 16-QAM modulated symbols andF is the DFT matrix with
Fm,n =1√Ne−j2π
mnN , m, n = 0, 1, . . . , N − 1
The received signal after linear convolution and CPremoval is given as
r = Hd + w
where H ∈ CN×N is the circulant channel matrix.After FFT at the receiver, we can write
Y = Fy = F(Hd + w) = FHFH︸ ︷︷ ︸Λ
D + Fw︸︷︷︸W
= ΛD + W
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 80 / 94
Mathematical Model of the Received Signal
Λ is a diagonal matrix, where the main diagonal is theCFR.Circulant matrices exhibit the following property
FHFH = diag(H[0], H[1], . . . , H[N − 1]) = Λ
The FFT output can be given as
Y [k] = H[k]D[k] +W [k], k = 0, 1, 2, ...N − 1
To remove the channel effects, we need to divide Y [k] bythe complex-valued channel coefficient, H[k], of thechannel frequency response (CFR).Hence, the equalizer one-tap weight are given as
CZF [k] =1
H[k]=
H∗[k]
|H[k]|2 , k = 0, 1, 2, ...N − 1
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 81 / 94
Example: Proakis Channel B
OFDM system with NFFT = 4, NCP = 2, thus,N = NFFT +NCP = 6
Channel impulse response:
h(z−1) = 0.407 + 0.815z−1 + 0.407z−2
Circulant channel matrix (time-domain):
H =
0.407 0 0 0 0.407 0.8150.815 0.407 0 0 0 0.4070.407 0.815 0.407 0 0 0
0 0.407 0.815 0.407 0 00 0 0.407 0.815 0.407 00 0 0 0.407 0.815 0.407
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 82 / 94
Circulant Matrix Demo
1 % OFDM system specs2 Nfft=4; Ncp=2; N=Nfft+Ncp;3
4 % Proakis B channel CIR5 h=[0.407 0.815 0.407]; L=length(h);6
7 % Circulant matrix8 H=gallery(’circul’,[h zeros(1,N-L)]).’;9
10 % DFT matrix11 F=1/sqrt(N)*dftmtx(N);12
13 % Channel frequency response (CFR)14 Lambda=diag(F*H*F’);15
16 % CFR via FFT17 Hf=fft(h,N);
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 83 / 94
Equalizer for Known Channel
After CP removal, FFT and zero forcing equalizer, thedecision variable becomes
D[k] = CZF [k]Y [k] =Y [k]
H[k]=H[k]D[k] +W [k]
H[k]
= D[k] +W [k]
H[k], k = 0, 1, 2, ...N − 1
Noise enhancement occurs if channel frequency responseexhibits spectral nulls and the noise term W [k]/H[k] is nolonger Gaussian.To prevent this, a Minimum Mean-Squared Error (MMSE)based equalizer can be be used instead designed as
CMMSE [k] =H∗[k]
|H[k]|2 +2σ2W
σ2D
, k = 0, 1, 2, ...N − 1
however, BER performance will only improve for codedsystems.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 84 / 94
Computation of CFR
At this point, we assume that the CIR is perfectly known.The CFR can be computed directly from the CIR as
H[k] =
N∑n=0
h[n]e−j2πnkN , k = 0, 1, . . . , N − 1
where h[n] = 0, ∀n ≥ L− 1
In MATLAB, we can use H=fft(h,N) to obtain the CFR.The second argument applies zero-padding to h, which isequivalent to oversampling of the CFR in frequencydomain to N samples.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 85 / 94
Code Developement Lab 8-9
Develop MATLAB code thatComputes the ZF and MMSE equalizer coefficients(computation is required only once as the channel istime-invariant).Implements the modified 16-QAM receiver using theone-tap weights.Computes and displays the simulated BER vs Eb/N0
performances for both equalizers.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 86 / 94
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 18
0
0.2
0.4
0.6
0.8
1
|Hest(k)|
subcarrier index, k
Data
Pilots
Estimates
Estimate unknown channel H[p] at pilot indices p.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 87 / 94
Linear Interpolation
Interpolate to obtain in-between channel values.The line equation connecting two points is given as
y − y1
y2 − y1=
x− x1
x2 − x1
y
x2x1
y1
y2
x
p p+ 1 p (Pilot index)
k k (OFDM index)
H(p+ 1)
H(p)
k + I
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 88 / 94
Linear Interpolation (Cont.)
Interpolation equation:
H[k] = H[p] +i
I
(H[p+ 1]− H[p]
)Indices:
p = 0, 1, . . . , P − 2,
i = 1, 2, . . . , I − 1,
k = p I + i
with P = 256 and I = 8
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 89 / 94
Linear Interpolation (Cont.)
For the data subcarriers after the P -th pilot we need toextrapolate the equation from the last two pilots, e.g.H(P − 2) and H(P − 1) and p = p+ P .
extrapolate
Np (Pilot index)
k (OFDM index)
H[P − 1]
H[P − 2]
P − 1P − 2
(P − 1)I(P − 2)I
H[k]
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 90 / 94
ZF Equalizer for Unknown Channel
Computing the zero-forcing equalizer
CZF [k] =1
H[k], k = 0, 1, 2, ...N − 1, k 6= p
Filtering the received signal
D[k] = CZF [k]D[k] =D[k]
H[k], k = 0, 1, 2, ...N − 1, k 6= p
BER should not be computed at the pilot locations, e.g.k = p
Thus, the total number of bits should be adjusted toaccount for the pilot overhead.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 91 / 94
Estimated and True Frequency Response
0 500 1000 1500 20470
0.5
1
1.5
2
2.5
Subcarrier Index k
H[k],H[k]
γ = 30 dB, K = 64
H[k]
H [k]
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 92 / 94
MSE vs. SNR For Different CPs
0 5 10 15 20 25 30−40
−35
−30
−25
−20
−15
−10
Eb
N0(dB)
MSE
(dB)
K=0
K=8
K=16
K=32
K=64
Mean Squared Error computation:
MSE = 10 log10
(1
N
N∑n=0
|Hn − Hn|2)
dB
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 93 / 94
Code Developement Lab 10-12
Develop MATLAB code thatEstimates the frequency response of the multipath channelusing pilots and computes the zero-forcing equalizercoefficients.Implements the modified 16-QAM receiver using one-tapequalizer and channel estimation.Computes and displays the BER vs Eb/N0 performancewith channel estimation.Computes the mean-squared error (MSE) as the functionof SNR in dB between the estimated and actual frequencyresponse of the channel.
For higher marks:Quadratic, Cubic and spline based interpolation may beimplemented.More sophisticated pilot schemes, e.g. comb and shift.
Dr. Charalampos C. Tsimenidis EEE8128 Communications and Signal Processing 94 / 94