Wireless Communications With Matlab and Simulink
Wireless Communications With Matlab and Simulink
by Roberto Cristi Professor Dept of Electrical and Computer Engineering Naval Postgraduate School Monterey, CA 93943 August 2009
Table of Content: 1. Introduction: WiMax, Matlab and Simulink 2. Introduction to Digital Signal Processing and Matlab 2.1 Discrete time Signals and Systems 2.2 Fast Fourier Transform (FFT) and its Inverse (IFFT) 2.3 Convolution and Correlation Lab 1: Matlab/Simulink Code 3. Digital Communications Fundamentals 3.1 General Structure of a Digital Communication System 3.2 Channel Losses and Noise 3.3 Complex Baseband Representation 3.4 Bit Error Probabilities 3.5 Simulink Implementation Lab 2: Matlab/Simulink Code 4. Channel Models 4.1 Introduction and Channel Losses 4.2 Models of Fading Channels 4.3 Channel Parameterization 4.4 Estimation of Channel Parameters from Data Lab 3: Matlab/Simulink Code 5. Multi Carrier Modulation and OFDM 5.1 Single Carrier and Multi Carrier Modulation 5.2 Orthogonal Frequency Division Multiplexing (OFDM) 5.3 Example: basics of IEEE 802.11a (WiFi) Lab 4: Matlab/Simulink Code 6. Error Correction Coding 6.1 Channel Capacity and Error Correction Coding 6.2 Block Codes 6.3 Convolutional Codes 6.4 Code Shortening and Puncturing 6.5 Simulink Implementation of IEEE802.16 coding schemes Simulink/Matlab Code: Error Correction
7. IEEE802.16 Implementation 7.1 Time Synchronization and Channel Estimation using the Preamble 7.2 Channel Tracking for Mobile Applications 7.3 Simulink Implementation of IEEE802.16-2004 (Fixed) 7.4 Simulink Implementation of IEEE802.16e-2005 (Mobile) Simulink/Matlab Code: IEEE802.16 Implementation 8. Multi Antennas 8.1 Receive Diversity 8.2 Transmit Diversity 8.3 Space Time Coding 8.4 Transmit Diversity with Space Coding in IEEE802.16 9. Issues in OFDM Systems Implementations 9.1 Peak to Average Power Ratio (PAPR) 9.2 IQ Imbalance 9.3 Frequency Offset
Personal (PAN), up to a few meters. It requires simple thumb like transmitters receivers. Typical: Bluetooth. Local (LAN), up to 300m. It requires simple box like devices. Typical: WiFi (IEEE802.11) Wide (WAN), up to a few miles. It requires towers and cellular technology. Typical: WCDMA, CDMA 2000, UMTS
3G: CDMA2000 and UMTS. All based on Spread Spectrum 3.5G: increased capacity by combining CDMA with TDM (Time Division Multiplexing). Voice and Data on separate channels. Current technology; 4G : to provide voice, data, multimedia services at low cost on an all IP (packets) network. IEEE802.16 (WiMax) is one of the technologies considered.
TODAY: voice and data on separate networks; TOMORROW: voice and data on the same network. Data using Voice Over IP (VoIP). Advantages: flexibility, control of QoS, scalable.
Evolution of IEEE802.16:
802.16 802.16-2004
10-66GHz 2-11GHz
Single Carrier SC, 256 OFDM, 2048 OFDMA SC, 256OFDM, 128, 512, 1024, 2048 OFDMA
802.16e-2005
Dec 2005
2-6GHz
In addition, IEEE802.16-2004 and 2005 have options based on Multi Antennas techniques.
Introduction to Simulink
Matlab based Both Continuous Time and Discrete Time Simulation Based on Blocksets Model Based Design: a software model of the environment can be developed and the design can be tested by simulation Transition between ideal algorithms (infinite precision, floating point) to real world algorithms (finite precision, fixed point); Automatic Code Generation: once the design is tested and validated, real time code can be automatically generated for the target platform Continuous Test and Verification
Simulink
Hierarchical block diagram design and simulation tool
Built-in notions of time and concurrency
Digital, analog/mixed signal and event driven Visualize Signals Co-develop with C code Integrated with MATLAB
Digital Mod
TX
Wireless Channel
RX
Digital Dem
00010101011101010100101111 0010101010010010101001001001.
Fading channel
Display signals
1. Discrete time Signals and Systems 2. Fast Fourier Transform (FFT) and its Inverse (IFFT) 3. Convolution and Correlation
1. Continuous Time to Discrete Time 2. Fundamental Signals: Delta Function, Sinusoid, Complex Exponential
x[n]
nTs
Sampling
x(t )
t
x[n] = x ( nTs )
Fs = 1 / Ts
Fs Ts
[n]
1. Delta or Impulse
2. Sinusoid phase
F0 0 = 2 Fs
Digital Frequency (radians)
Example: F = 10kHz s
Digital frequency:
F0 = 2kHz Fs = 10kHz
0 = 2
Generate it in matlab: plot_a_sinusoid.m n=0:100; A=10; w0=2*pi/5; alpha=0.1; x=A*cos(w0*n+alpha); plot(x); x=[10*cos(0.1), , 10*cos((2*pi/5)*100+0.1)] n=[0,1,2,,100]
3. Complex Exponentials
where
j = 1
imaginary basis
A cos(0 n + ) = Re Ae
j (0 n + )
Sinusoids and Frequency Spectrum Complex exponentials are the building blocks of signals and systems. Reasons: all operations of interest boil down to multiplications or divisions A sinusoid in terms of complex exponentials can also be written as
A j (0 n + ) A j (0 n + ) A cos(0 n + ) = e + e 2 2
x n
x[n], n = 0,..., N 1
1. Define the FFT
N 1
X = FFT {x}
where
X [k ] = x[n]e
n =0
N 1
jk
2 n N
k = 0,..., N 1
x = IFFT { X }
where
1 x[n] = N
X [k ]e
k =0
N 1
jk
2 n N
n = 0,..., N 1
Meaning:
X [k ], k = 0,..., N 1
is the component of the spectrum due to frequency
F F =k s N
Example: Let
| X [k ] |
Fs = 10kHz N = 1024
0
220
1023
F = 220
Example: example_of_fft.m Data length N=1024; Sampling Frequency Fs=10kHz X=fft(x); k=0:1023; f=k*Fs/N; % frequency axis plot(f,abs(X))
4000 3500 3000 2500 2000 1500 1000 500 0 FFT of cosine
1000
2000
3000
4000
5000 Hz
6000
7000
8000
9000 10000
Freq. = 1kHz
1. Convolution as system response 2. Autocorrelation of data 3. Crosscorrelation between data sets 4. Estimation of Impulse Response using Crosscorrelation
Operations of Interest
1. Convolution. To compute the output of a Linear Time Invariant system Impulse response
x[n] h[n]
Input signal
y[n]
output signal
Definition of Convolution:
+
l =
h[l]x[n l]
Input data
convolution
x
0
N 1
h
0
M 1
Output data
=
0
y
N +M 2
In matlab: Let 1. h be the vector of impulse response; 2. x be the input vector Then the output vector y=conv(h,x);
Example: convolution_of_finite_sequences.m h=[1,0,0,0.5,0,-0.2,0,0.1]; n=0:200; x=2*cos(0.1*pi*n); y=conv(h,x); plot(y) % impulse response % input signal % output signal
2. Auto Correlation. For a signal with zero mean, to see if the samples are correlated with each other Definition of Auto Correlation:
rx [m] =
n =
x[n]x*[n m]
x[n], n = 0,..., N 1
1 rx [m] = N
N 1
2 1 x = rx [m] = N 0,
| x[n] |2 , if m = 0
n =0
N 1
rx [m]
otherwise
Example: xcorr_of_white_noise.m
4 3 2
1 0 -1 -2 -3 -4
100
200
300
400
500
600
700
800
900
1000
autocorrelation of x 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 -0.2 -1000
-800
-600
-400
-200
400
600
800
1000
2. Cross Correlation. To see if two signals are correlated with each other
ryx [m] =
With finite length signals:
n =
y[n]x*[n m]
1 ryx [m] = M
M 1 n =0
Case of Interest: estimation of the impulse response of a Linear Time Invariant system from input-output data
x[n] h[n]
y[n]
If
Example: impulse_response_with_xcorr.m h=[1, 0, 0.2, -0.5, 2, -0.1]; % impulse response y=conv(h,x); ryx=xcorr(y,x) /length(y) h_est=ryx/ryx(length(x));
2.5
1.5
0.5
-0.5 -1.5
-1
-0.5
0.5
1.5 x 10
4
2.5
1.5
zoom in
0.5 0
A. Sinusoids and the FFT: A.1 Generate a sinusoid with the following parameters and plot it vs time: Amplitude Frequency Sampling Frequency Phase Length
A = 5. 0
= 30 0 128 samples
Reference: plot_a_sinusoid.m
A.2 Take the FFT of the sinusoid you generated, plot its magnitude (absolute value), and verify that you obtain the frequency you expect.
Reference: example_of_fft.m
B. White Noise, Convolution, Correlation: 1. Generate a gaussian white noise signal with the following parameters:
x = 5
N = 10,000 data points
Plot its autocorrelation and verify that it is as expected. 2. This signal is the input to a system with impulse response
h = [1,0,2,0.5,0,0,0,0.3]
Determine the output sequence and verify that the crosscorrelation between input and output is a good estimate of the impulse response of the system.
Reference: impulse_response_with_xcorr.m
2. Digital Communications Fundamentals and the Additive White Gaussian Noise (AWGN) Channel
1. General Structure of a Digital Communication System 2. Channel Losses and Noise 3. Complex Baseband Representation 4. Bit Error Probabilities 5. Simulink Implementation
source of information
..01010110
Digital Mod bits
I Q
destination
Carrier frequency Carrier frequency
..01010010
Errors! I Q
TX
pulses
channel
RX
pulses
decision symbols
Q
symbols
Q
Discrete Time
Discrete Time
1.2 Goals
Bit Error Rate within acceptable values; Stay within the available resources: Channel Bandwidth Noise Interference Variability
Transmitted Power
Receiver Complexity
TX
..01010110
channel
RX
..01010010
Errors!
1.3 Parameters
FS = symbols sec
ES = Joules symbol
bits
a[n]
Nb =
bits symbol
PT = ES FS Watts
symbols
xI [n]
DAC DAC
xI (t )
pulses RF
A= PR PT
Digital Modulator
xQ [n]
xQ (t )
channel
bits
a[n]
symbols
Digital Demodulator
PW = Watts
ADC ADC
y I (t )
yQ (t )
y I [n]
yQ [n]
w(t )
RF pulses
PR = A PT Watts
P SNR = R PW
Q (Im) BPSK
[b0 ]
1 +1
I (Re)
b0
N b = 1 bit/symbol
Q
b1 0
4-QAM (QPSK)
[b0 , b1 ]
I
1
b0
1 +1
N b = 2 bits/symbol
Q
01
16-QAM
[b0 , b1 , b2 , b3 ]
b1 , b0
00
I
10
N b = 4 bits/symbol
11
b3 , b2
11
10
00
01
Symbols to Pulses: Digital to Analog (DAC) and Analog to Digital (ADC) Conversion
x[n]g (t nTS )
symbol
pulse
x[n] n
x(t )
DAC
gT (t )
nTS
symbol
pulse
y[n] n
y (t )
ADC
g R (t )
n =
x[n]g (t nT )
S
nTS
g (t ) G (F )
TS
FS = 1 / TS Symbol Rate
t (sec)
F (Hz )
B
Symbol interval
+
Bandwidth
ES = | g (t ) |2 dt = | G ( F ) |2 dF
+
PT =
ES = ES FS TS
G (F )
1.5
0.2 0
0.5
-0.2
-0.4 -4
-3
-2
-1
0 t
0 -1.5
-1
-0.5
0
smaller bandwidth more ISI
B 1 = 1 FS
F FS
0 f
0.5
1.5
2.1 Transmitted Pulses to Received Pulses 2.2 Energy per Symbol, Power Spectral Density 2.3 Signal to Noise Ratio and Eb/N0
attenuation: free space, obstacles, foliage noise: thermal, interferences from other systems/users multipath: reflections from buildings, structures, hills doppler shift: motion of transmitter, receivers, reflectors
Transmit
Receive
Transmitted Power
PT = ES FS Watts
Received Power
PR = A PT Watts
w(t )
PW = N 0 B Watts
Symbol Rate
Thermal Noise
Present in all electronic systems, it is dependent on temperature; It is white, in the sense that it is equally spread in frequency.
Power Spectral Density
N0 / 2
F (Hz )
N 0 = kT = (1.383 10 23 J / K ) T
Boltzmans constant
In dBm:
N 0 dB = 174dBm / Hz
FS SNR = B
ES F = Nb S N 0 B
Eb N 0
FS = symbol rate (1/sec) B = bandwidth ( Hz = 1 / sec) FS N 0 = noise power spectral density ES = Energy per symbol (Joules) Eb = Energy per bit (Joules) N b = bits per symbol
A cos(2Fc t )
xI [n]
I
DAC
gT (t ) gT (t )
xI (t ) xQ (t )
A sin (2Fc t ) A cos(2Fc t )
DAC
yT (t )
channel
xQ [n]
Received Q
y I [n]
I
Ts
g R (t ) g R (t )
y I (t ) yQ (t )
A sin (2Fc t )
y R (t )
yQ [n]
j = 1
Ae
= A cos( ) + j A sin( ) 1 24 4 3 1 24 4 3
Real Part Im
A
Imaginary Part
Re
As a consequence:
Ae
j 2FC t
It is easier to define one complex signal which combines In Phase and Quadrature components:
x[n] = xI [n] + jxQ [n]
Im
Ae j 2Fct
DAC
gT (t )
Re{.}
yT (t )
Re
channel
y[n] = y I [n] + jyQ [n]
Im
y R (t )
g R (t )
Re
Ts
Ae j 2Fct
If the carrier frequency is larger than the bandwidth of the filters, then it can be simplified as Baseband Channel
x[n] = xI [n] + jxQ [n]
DAC
Re
A j 2Fct e 2
gT (t )
channel
y[n] = y I [n] + jyQ [n]
Im
g R (t )
Ts
Re
A j 2Fct e 2
x(t )
x(t )
gT (t )
Complex Baseband channel
A C+ ( F FC ) 2
F
Real channel
FC FC
F
same
y (t )
y (t )
g R (t )
g R (t )
A j 2Fct e 2
Advantage: all signals at lower frequencies, therefore much easier to simulate and analyze.
Complex
x[n]
Encoder
Digital Modulator
complex
Baseband Channel
Decoder
Digital Demodulator
y[n]
Complex
4.1 Eb/N0 and SNR for MQAM Signals 4.2 Probability of Symbol Error in Additive White Gaussian Noise (AWGN) Channel;
.01001011001010
M-QAM
ES / TS log 2 ( M ) Eb FS SNR = = B N0 B N0
Therefore, if FS B :
Eb 1 SNR = N 0 log 2 ( M )
( ) P 2Q ( 2 )
E PS = Q 2 Nb0 S Eb N0
3 log M 2 PS 4Q M 1
Eb N 0
M-QAM:
where
Pb
1 PS log 2 ( M )
+
1 Q( x) = 2
e t
x
dt
x = 1 erfc 2 2
10
-2
10
-3
10
-4
10
-5
10
-6
-5
10 Eb/No dB
15
20
Example. Same as previous example Compute: a. Symbol Error Rate, b. Bit Error Rate Solution: 1. From the previous Example Eb / N 0 = 8.6dB 2. Symbol Error Rate: 10 4 errors per symbol (see graphs) 3. Bit Error Rate: 10 4 / 2 = 5 10 5 errors per bit
5. Simulink Implementation
5.1 Fundamentals of Simulink 5.2 Digital Communications in AWGN: Simulink Implementation; 5.3 Example
Simulink has three classes of blocksets: sources (outputs only) processes (inputs/outputs) sinks (inputs only)
source
process sink
5.3 Example
Parameters:
M-QAM Fs symbols/sec
Modulation Communications Sources >Random Data Sources >>Bernoulli >Digital Baseband Mod >>AM >>>Rectangular
Binary
QAM
Baseband Channel
1 PT PT x[n] + w[n] y[n] = A SNR PR
Transmitter Gain
Blocks:
Comms Sinks > Error Rates Calculation Simulink > Sinks > Display
1. Simulate the system for the following values of the Signal to Noise Ratio: SNR=5,10,20dB 2. For each case determine the probability of bit error experimentally 3. Compare with the theoretical values References: AWGN_no_coding.mdl bit_error.m
10
-2
10
-3
10
-4
10
-5
10
-6
-5
10 Eb/No dB
15
20
3. Channel Models
1. Introduction and Channel Losses 2. Models of Fading Channels 3. Channel Parameterization 4. Estimation of Channel Parameters from Data
1.1. Large Scale fading: Free Space Losses 1.2. Medium Scale Fading: Shadowing 1.3. Small Scale Fading: Multipath
Wireless Channel
Frequencies of Interest: in the UHF (.3GHz 3GHz) and SHF (3GHz 30 GHz) bands; Several Effects: Path Loss due to dissipation of energy: it depends on distance only Shadowing due to obstacles such as buildings, trees, walls. Is caused by absorption, reflection, scattering Self-Interference due to Multipath.
log10 distance
6GHz
UHF
300MHz
Receive antenna
Lp L p = 20dB
20dB / dec
d0
10d 0
log10 ( d )
distance
Valid for: Satellite Communicationss Point to Point LOS Microwave Reference for Path Loss Models
Typical of open environments such as rural roads Small to medium distances constructive/distructive interference
l
hT
xT xR
1 + e j
hR
= 2
Large distances
xT + xR l
l
hT
xT xR
d
hR
monotonic
-40 -60 -80 -100 -120 -140 -160 -180 -200 -220 0 10
1 2 3 4 5
40dB / dec
independent of frequency
2 Prec hT2 hR 4 Ptrans d
10 10 10 d in meters 10 10
Prec Ptrans
L p = 20 log10 ( / 4) + 20 log10 (d )
40dB
Lp
Two Ray Approximation:
20dB
log10 ( d )
hT
hR
L p = E {L p }+
expected value
6 12 dB
Average Loss
Free space loss at reference distance
d E{L p } = 10 log10 + L0 d 0
Path loss exponent
dB
BS antenna 30-100m high; Hata: similar to Okumura, but simplified COST 231: Hata model extended by European study to 2GHz
Lp
Propagation Loss
Lp = + log10 ( d )
log10 ( d )
= 44.9 6.55log10 (h )
urban
f = frequency in MHz hT, hR = transmitter antenna elevation over average terrain (in meters)
a ( hR ) corrective factor for receiver antenna
Propagation Loss
Lp = + log10 (d ) + CM
= 44.9 6.55log10 (h ) = 0 = 46.3 + 33.9 log10 ( f ) 13.82 log10 (hT ) a (hR )
where
Restrictions:
Example:
PT
PR = ?
Base Station
d = 500m
Subscriber
Given:
d Channel: L p = 10 log10 d + L0 + 0 d = 1m
0
L0 = 45dB
=3 = 6dB
Transmitted Power:
N 0 = 174dBm / Hz thermal
SNR = 96 + (104) = 8 + dB
random
P ( > a ) =
Where we define
1 2
+ 1 x 2
e
a
dx =
t 2
erfc( x) =
1 a erfc 2 2
dt
0.75
0.10
0.1 0 -1
-0.5
0.5 x
1.5
BPSK: a=3dB
16QAM: a=14.7dB
3. Small Scale Fading due to Multipath. a. Spreading in Time: different paths have different lengths;
Transmit
x (t ) = (t t0 )
Receive
y (t ) = L + hk (t t0 k ) + ...
t0
time
t0 1 2
x (t ) = (t t0 )
t0 1 2 MAX
t0
channel
Transmit
time
Receive
y (t ) = YR e
j 2 ( f c +f )t
v
for each path time
Doppler Shift
fc
f c + f
Frequency (Hz)
x(t )
Transmit
time
Receive
y (t )
time
attenuation
shift in time
j 2 ( Fc + Fk )( t k ) y (t ) = Re ak x (t k )e k
paths
2.1. Statistical Models of Fading Channels 2.2. Non Line of Sight (Rayleigh) and Line of Sight (Rice) Channels 2.3. Simulink Example
2.1 Statistical Models of Fading Channels each reflector has several paths all with different time delays and doppler shifts
Several Reflectors:
x (t )
Transmit Receive
y ( t ) = yl (t )
l
r v
yl ( t )
l + k
v
cos( k )
j 2 ( Fc + Fk )( t l k ) yl (t ) = Re ak e x (t l k ) k
j 2 Fct j 2Fk t j 2 ( Fc + Fk ) k y (t ) = Re ak e e x (t k ) e k
r (t ) = rI (t ) + jrQ (t ) ak e
k
j 2Fk t j 2 ( Fc +Fk )( l + k )
x (t l )
leading to this:
Assume
x (t ) x (t k )
r (t ) = cl (t ) x (t l )
with
cl (t ) = ak e
k
j 2Fk t j 2 ( Fc +Fk )( l + k )
cl (t ) = ak e
k =1
random
random
E{cl (t )} = 0
* l
since
k
M
E {cl (t )c (t + t )} = E{| ak | }e
k =1
cos k t
Assume Then
Pl E{| ak | } = M
2
1 * E {cl (t )cl (t + t )} = Pl M
e
k =1
j 2
cos k t
v j 2 cos t = Pl E e
1 = Pl 2
e
0
j 2
cos t
d = Pl J 0 (2 FD t )
And PSD
1 2 Pl F Sl ( F ) = D 1 ( F / FD ) 2 0
if | F |< FD otherwise
with
FD
S l (F )
FD
x(t )
time
y (t )
time
v
1
time
L
x(t )
time
c1 (t )
L
N
delays
cl (t )
y (t )
time
cN (t )
cl (t ) = Pl g (t )
unit power time invariant from power distribution time varying (from autocorrelation)
[ 1 [P1
FD
2 L L]
sec dB Hz
P2 L PL ]
Non Line of Sight (NOLOS) and Line of Sight (LOS) Fading Channels
1. Rayleigh (No Line of Sight). Specified by: Time delays
E{cl (t )} = 0
T = [ 1 , 2 ,..., N ] P = [ P , P2 ,..., PN ] 1
FD
E{cl (t )} 0
K
PLOS = K PTotal 1+ K
PNOLOS =
1 PTotal 1+ K
Simulink Example
M-QAM Modulation
Rayleigh Fading
Bit Rate
v FD = FC c
3 108 m / sec
modulation power
channel
Rayleigh Fading
Doppler freq:
FD = 70 Hz
Fb = 20MHz
Bits/Symbol: 2 (QPSK)
FS / 2 FS / 2
Rayleigh Fading
Doppler freq:
FD = 2 Hz
Fb = 20MHz
Bits/Symbol: 2 (QPSK)
FS / 2 FS / 2
Channel Parameterization
1. Time Spread and Frequency Coherence Bandwidth 2. Flat Fading vs Frequency Selective Fading 3. Doppler Frequency Spread and Time Coherence 4. Slow Fading vs Fast Fading
1. Time Spread and Frequency Coherence Bandwidth Recall that the Channel Spreads in Time (due to Multipath): Received Power
x (t ) = (t t0 )
0 10
t0
channel
20
MAX RMS
time
FT
Coherence Bandwidth
Bc =
1 5 RMS
frequency
Bc =
1 5 RMS
F
Signal Bandwidth
Frequency coherence
Flat Fading
Signal Bandwidth
< >
Frequency Coherence
Distortion!!!
Example: Flat Fading Channel : Delays T=[0 10e-6 15e-6] sec Power P=[0, -3, -8] dB Symbol Rate Fs=10kHz Doppler Fd=0.1Hz Modulation QPSK
Example: Frequency Selective Fading Channel : Delays T=[0 10e-6 15e-6] sec Power P=[0, -3, -8] dB Symbol Rate Fs=1MHz Doppler Fd=0.1Hz Modulation QPSK
y (t ) = cl (t ) x(t l )
l =1
c l (t ) c l (t + t )
if
| t | TC < 1 / F D
same response
different response
x (t )
y (t )
TC
Coherence Time:
TC
9 16 FD
Max Doppler
TC
9 16 FD
t
Symbol period
Time coherence
Slow Fading
Symbol period
< >
Time Coherence
Channel quickly changing
Fast Fading
S (t , F )
F
FD
TC
9 16 FD
mean
Time Spread
RMS
Frequency Coherence
Bc =
1 5 RMS
1. Recall Impulse Response Identification from Correlation 2. Estimation of Time Spread and Doppler Shift 3. Simulink/Matlab Example 4. Stanford University Interim (SUI) Channel Models
Estimation of Channel Characteristics from Input - Output data. 1. For Linear Time Invariant (LTI) systems:
x[n]
y[n]
h[n]
m =
h[k ]x[n k ]
R yx [m] = E y[n]x*[n m] =
+ k =
}
+ * k =
In matlab:
x[n]
y[n]
x
2. Compute crosscorrelation between input and output:
h=xcorr(x,y);
If
h[n]
x[n]
Known:
y[n]
h[m, n]
Fs
y[n] =
k =
h[k , n]x[n k ]
1. Sampling frequency
Fs FD max
:
n = NB N
x y
N Ts << TD min
xN=reshape(x,N,length(x)/N); yN=reshape(x,N,length(y)/N);
L L
n = lN
L L
xN,yN=
[
l
NB
2. Estimate impulse response in each block
m
hN=xcorr(xN,yN); hN=
NB
h[m, n] n =lN
3. Compute Power Spectrum on each row, to determine time variability of the channel (If the channel is Time Invariant all columns of hN are the same):
l
m
hN=
[ ]
L L
h[m, n] n =lN
m (time)
k (freq.)
S=fft(hN); S=S.*conj(S);
S=
[ ]
S [m, k ]
NB
4. Take the sum over rows for Doppler Spread and sum over columns for Time Spread (fftshift each vector to have zero term (sec or Hz) in the middle Sf St
t = m / Fs
f =k
( Fs / N ) NB
Time Resolution:
t = 1 / FS
F = FS 1 Hz = N N B total data length(sec)
Frequency Resolution:
Therefore if we want to a resolution in the doppler spread of (say) 1Hz, we need to collect at least 1 sec of data.
Example:
y To Workspace1
x To Workspace
test_scattering.mdl
St(t)
8 7 6 5 4 3 2 1
1.2 x 10
-3
Time Spread
Frequency Spread
0 -1.5
-1
0.5 x 10
1
-4
Sf(f)
1 0.8
15 sec
Frequency Spread
0.6 0.4
0.2
0 -1000
-800
-600
-400
400
600
800
1000
70 Hz
+ 70 Hz
Extension of Work done at AT&T Wireless and Erceg etal. Three terrain types: Category A: Hilly/Moderate to Heavy Tree density; Category B: Hilly/ Light Tree density or Flat/Moderate to Heavy Tree density Category C: Flat/Light Tree density
Six different Scenarios (SUI-1 SUI-6). Found in IEEE 802.16.3c-01/29r4, Channel Models for Wireless Applications, http://wirelessman.org/tg3/contrib/802163c-01_29r4.pdf V. Erceg etal, An Empirical Based Path Loss Model for Wireless Channels in Suburban Environments, IEEE Selected Areas in Communications, Vol 17, no 7, July 1999
Lab 3
In this project you want to identify the time and frequency spreads of a channel. Refer to the simulink model Lab3.mdl for the setup. You know that the mobile channel you are trying to model has a maximum doppler frequency not exceeding 50Hz and a maximum time spread smaller than 20 microseconds. In order to have a clear picture of the channel spread in time and frequency we want a time resolution of 1 microsecond and a frequency resolution of 1Hz; 1. Based on the time and frequency resolutions, determine a suitable symbol rate of the transmitted sequence and an adequate data length in time; 2. With the above parameters, run the model Lab3.mdl to collect the transmitted and received data. Use the program scattering.m to estimate the time and frequency spreads of the channel. Compare the result with the parameters of the channel in the simulink block; 3. Just to compare, try different values of symbol rate and data length and see how the resolutions in time and frequency are affected.
1. 2. 3.
Single Carrier and Multi Carrier Modulation Orthogonal Frequency Division Multiplexing (OFDM) Example: basics of IEEE 802.11a (WiFi)
1. 2. 3. 4. 5.
Transmission of Data through Frequency Selective and Time Varying Channels Single Carrier Modulation in Flat Fading Channels Single Carrier Modulation in Frequency Selective Channels Simulink Example of Single Carrier Modulation The Multi Carrier Approach
We have seen a wireless channel is characterized by time spread and frequency spread.
Frequency Spread
S (t , F )
F FMAX
t
t MAX
Time Spread
if symbol duration >> time spread then there is almost no Inter Symbol Interference (ISI). channel
TS
time
channel
1 / TS
Frequency
Flat Freq. Response
Frequency
Frequency
if symbol duration ~ time spread then there is considerable Inter Symbol Interference (ISI). channel
time
time
time
Problems with equalization: it might require training data (thus loss of bandwidth) if blind, it can be expensive in terms computational effort always a problem when the channel is time varying
let symbol duration >> time spread so there is almost no Inter Symbol Interference (ISI); send a block of data using a number of carriers (Multi Carrier)
symbol
1
symbol
0
time
0 1
channel
time
1 0
time
Frequency
1 0 1 1
One symbol
channel
L
Frequency
0 1 0 1 1 1
MC
subcarriers
Frequency
Each subcarrier sees a Flat Fading Channel: Easy Demod
0 1 0 1 1 1
Block of symbols
1. Basic Structure of Multi Carrier Modulation 2. Orthogonal Subcarriers and OFDM 3. Generating the OFDM Symbol using the IFFT
In MC modulation each MC symbol is defined on a time interval and it contains a block of data
OFDM Symbol
data
data
data
data
time
TSymbol
data t
Tg
guard interval
Tb
data interval
data
0 t TSymbol
ck
is modulated by a subcarrier
NF NF Fk = FC + kF , k = ,..., , k 0 2 2
Subcarrier k = 0 is not used since its magnitude and phase would be influenced by the carrier FC
| S (F ) |
Fk = FC + kF
Fc
BW 2
Fc
Fc +
BW 2
Fc
BW 2
Fc
carrier
Fc +
BW 2
BW = N F F
TX
RX
Tb
L
TSymbol data+guard
the guard time is long enough, so the multipath in one block does not affect the next block
RX TX
L
NO Inter Symbol Interference!
Modulated Signal:
s (t ) = Re e j 2Fct x(t )
FT
FC = carrier frequency
FC
FC
FT
j 2kF ( t Tg )
x(t ) = A
just a gain
k = k 0
ce
k
NF 2
NF 2
0 t TSymbol
ck = data
Limitations of OFDM
TSymbol
data t
Tguard Tb
The Guard Time (or Cyclic Prefix) does not carry data and therefore it represents a loss of power
Pdata Tb = Psymbol = Tb + Tguard 1 Tguard 1+ T b Psymbol
To minimize overhead
Tguard << Tb
Frequency Spread
S (t , F )
t
t MAX sec
OFDM Symbol Duration: OFDM Freq. Spacing: Are these two compatible? Since
FS 1 1 = = N NTS Tb
Time Spread
Tb >> t MAX
F = FS >> FMAX N
we have:
t
guard interval Tg
Tb data interval
1 Choose: F = Tb
FC
F
Fk = FC + kF
Orthogonality:
1 Tb
t 0 +Tb
t0
j 2Fk t j 2Fl t
1 dt = Tb
t 0 +Tb
t0
j 2 ( k l ) Ft
1 if k = l dt = 0 if k l
Since the channel is Linear and Time Invariant (at least for the duration of the frame), the exponentials e j 2Fk t are still orthogonal at the receiver in steady state, ie after the transient has died.
Transmitted subcarrier j 2Fk t
channel
Received subcarrier
t
0
Tg + Tb
h(t )
0
Tg
Tg + Tb
H ( Fk )e j 2Fk t
Tg t Tg + Tb
Each OFDM symbol is generated in discrete time. Let FS be the sampling frequency; N > N F be the number of data samples in each symbol; F = 1 / (N TS ) = FS / N A=1/N Then:
NF 2 NF 2
1 x(nTS ) = N
c e
k k = NF 2
j 2k F ( n L ) F
s
1 = N
c e
k k = NF 2
jk 2N ( n L )
n = 0,.., L + N 1
4. Generating the OFDM symbol using the IFFT OFDM Symbol: discrete time
# samples # subcarriers
guard
data
N > NF
TIME:
0
Tg
Tb
Freq spacing F = FS / N
FREQUENCY:
FS / 2
N F F S 2 N
N F FS 2 N
FS / 2
c e
k k = NF 2 k
NF 2
jk 2N n
c e
k =1 N 1 k =0
jk 2N n
1 + N
c e
k k = NF 2
j ( N + k ) 2N n
X [k ]e
jk 2N n
=IFFT {X [k ]}
Where:
X [ k ] = ck , X [ N + k ] = ck , X [k ] = 0, k = 1,..., N F / 2 k = 1,..., N F / 2 otherwise
positive subcarriers negative subcarriers
L + N 1
CP
14 4 2 3
IFFT{ X }
N
14243
x[n] = x[ N + n]
OFDM Symbol
Cyclic Prefix
k
0
x[0] = x[ N ]
x[ L 1] = x[ N + L 1]
n
0
c1
cN F / 2
0
x[L]
M
0
(N F / 2 )
M
IFFT
data
c N F / 2 c1
M M
N (N F / 2)
M
N 1
N 1 N 1
x[ L + N 1]
4*L<N<<Fs/F_D, integer
NF=[N*BW/Fs], integer
Test in Simulation:
w[n]
m-th data block (data, pilots and nulls)
X m [0] X [k ] M m M X m [ N 1]
OFDM TX
h[n]
OFDM RX
M M
Ym [0] Ym [k ]
Ym [ N 1]
Ym [k ] = H m [k ] X m [k ] + Wm [k ]
With H m [ k ] the frequency response of the channel within the time block In order to estimate X m [k ] we need to know the channel.
Data:
d m [k ]
X m [k ] = d m [k ] X m 1[k ]
X m1[k ]
X m [k ] = X m 1[k ] + d m [k ]
At the receiver
Ym [k ]
div
Delay one frame
d m [k ]
Ym1[k ]
Lab 4: Single Carrier vs. OFDM Modulation Goal: In this Lab we want to compare Single Carrier (SC) modulation with Orthogonal Frequency Division Multiplexing (OFDM), with Differential Modulation . 1. Using the Simulink model test_SC.mdl see the received signal for various values of the symbol rate
FS = 2.0, 20.0, 200.0, 2000.0 kHz
As the symbol rate increases, notice the effect of Inter Symbol Interference in the scattering plot.
2. Repeat the same with the Simulink model test_OFDM.mdl and see the received signal for the same values of the symbol rate. Notice how you can increase the data rate and still be able to demodulate the received signal.
NULL
c1
0 1
c26
N F = 52
NULL
M M
M M M M
63
x0
N = 64
26
c 26
38
c1
Frequency
Pilots at: -21, -7, 7, 21
M
63
x63
Time
IFFT
Frequencies:
F = 20 MHz / 64 = 312.5kHz
L
( 64 26 )
L
63 1
38
26
8.125
Subcarriers index
8.125
F ( MHz )
16.25MHz
DATA
F (MHz )
FCARRIER 10
FCARRIER
20 MHz = 1 / Ts
FCARRIER + 10
Time Block:
Ts = TFFT / 64 = 50 10 9 sec
TG = 0.8 sec
time
Overall Implementation (IEEE 802.11a with 16QAM). 1. Map encoded data into blocks of 192 bits and 48 symbols: data
Encode Buffer Interleave (192 bits) 010011010101 1110 0111 1000 1101 Map to 16QAM
al
+1+j3 -1+j +3-j3 +1-j
48
48
4
4x48=192 bits
Overall Implementation (IEEE 802.11a with 16QAM). 2. Map each block of 48 symbols into 64 samples time domain frequency domain xm [0] null 0 0
+1+j3 -3-j +3-j3 +1-j
24 data 2 pilots
M
null
1
26 27 27 + 64 26 + 64 1+ 64
1 2
xm [1]
24 data 2 pilots
MM
62 63
xm [62] xm [63]
am [ l ]
l = 1: 48
X m [k ]
IFFT
xm [ n ]
n = 0 : 63
k = 0 : 63
L
26
1 1
L
26
Simulink Example
To make it simpler: 1. let the number of carrier be the same as the FFT length, ie N=NF; 2. Use Differential QPSK Encoding and Decoding, so that we do not need to estimate the channels frequency response.
Simulink Implementation of OFDM IEEE802.11a Recall how we compute the IFFT at the Modulator IN: Block of 52 data points (data + pilots)
NULL
Recall: vectors in Matlab begin at n=1
x(49)
d1
0 1 26
x(1)
x(64) x(1)
d 26
NULL
M M M M
63
CP
d 27 d 52
M
38
M M
x(64)
M
63
x(64)
IFFT
Concatenate in a vector
0
Transmitted Frame
26 0 26
1 26 11 26
64
80
Split Data
IFFT
ADD CP
OFDM Modulator:
Simulink > Commonly Used Blocks > demux Simulink > Math Operations > Matrix Concatenate
OFDM Demodulator:
Received Frame
80 64 1 26 11 26 26 52 26
Received Data
Remove CP
FFT
Concatenate in a vector
demux
Differential enc/dec
This is particularly important when the signals are vectors. Some blocks want the input to be Frame based, others want it Sample based, others dont care When you have to process a large number of data, it is more efficient to process blocks of samples, using Frames, rather than one sample at a time.
Frame based
Sample based
There are N different signals. Each element of the vector belongs to a different signal.
N
[Nx1]
To Frame
[Nx1]
sample
frame
IEEE 802.16 2004: Part 16: Air Interface for Fixed Broadband Wireless Access Systems
From the Abstract: It specifies air interface for fixed Broadband Wireless Access (BWA) systems supporting multimedia services; MAC supports point to multipoint with optional mesh topology; multiple physical layer (PHY) each suited to a particular operational environment:
WirelessMAN-SC, Single Carrier (SC), Line of Sight (LOS), 10-66GHz, TDD/FDD WirelessMAN-SCa, SC, 2-11GHz licensed bands,TDD/FDD WirelessMAN OFDM, 2-11GHZ licensed bands,TDD/FDD WirelessMAN-OFDMA, 2-11GHz licensed bands,TDD/FDD WirelessHUMAN 2-11GHz, unlicensed,TDD
IEEE 802.16e 2005: Part 16: Air Interface for Fixed and Mobile Broadband Wireless Access Systems Amendment 2: Physical and Medium Access Control Layers for Combined Fixed and Mobile Operation in Licensed Bands and Corrigendum 1
Scope (Section 1.1): it enhances IEEE 802.16-2004 to support mobility at vehicular speed, for combined fixed and mobile Broadband Wireless Access; higher level handover between base stations; licensed bands below 6GHz.
IEEE 802.16-2004: Reference Model (Section 1.4), Figure 1 External Data SAP=Service Access Point Section 5
By Layers:
MAC
Section 6
Section 7
Section 8
802.16-2004
Frequency Band OFDM carriers 2GHz-11GHz OFDM: 256 OFDMA: 2048 QPSK, 16QAM, 64QAM 1Mbps-75Mbps TDD or FDD (1,2,4,8)x1.75MHz (1,4,8,12)x1.25MHz 8.75MHz
802.16e-2005
2GHz-11GHz fixed 2GHz-6GHz mobile OFDM: 256 OFDMA: 128, 256, 512,1024, 2048 QPSK, 16QAM, 64QAM 1Mbps-75Mbps TDD or FDD (1,2,4,8)x1.75MHz (1,4,8,12)x1.25MHz 8.75MHz
IEEE802.16 Structure
data
randomization Error Correction Coding
M-QAM mod
OFDM mod
TX
data
De-rand.
M-QAM dem
OFDM dem
RX
Choices: Coding rates 1/2 2/3 3/4 5/6 M-QAM 2 4 16 64 OFDM carriers 256 512 1024 2048 Channel B/width 1.25 MHz 5 MHz 10 MHz
Mobile WiMax is based on OFDMA; OFDMA allows for subchannellization of data in both uplink and downlink; Subchannels are just subsets of the OFDM carriers: they can use contiguous or randomly allocated frequencies; FUSC: Full Use of Subcarriers. Each subchannel has up to 48 subcarriers evenly distributed through the entire band; PUSC: Partial Use of Subcarriers. Each subchannel has subcarriers randomly allocated within clusters (14 subcarriers per cluster) .
Section 8.3.2: OFDM Symbol Parameters and Transmitted Signal OFDM Symbol
Ts
Tg
guard (CP)
Tb
data
Tg
1 1 1 1 = , , , Tb 4 8 16 32
An OFDM Symbol is made of Data Carriers: data Pilot Carriers: synchronization and estimation Null Carriers: guard frequency bands and DC (at the modulating carrier) pilots data
N guards = to provide frequency guards between channels N nulls = N guards + 1 (DC subcarrier is always zero) N pilots = pilots for channel tracking and synchronization N data = data subcarriers N used = N pilots + N data
f c BW 2
fc
f c + BW 2
f c BW 2
fc
carrier
f c + BW 2
128 108 20 12 96
1444444 444444 2 3
Fixed WiMax Fixed and Mobile WiMax
Fs BW 2 2
Frequency Spacing f = 1 / data_symbol_length = 1 / Tb Sampling frequency Bandwidth
BW 2
Fs 2
Fs = N FFT f
BW = N used f = N used Fs N FFT
Since we want the sampling rate to be integer multiple of a fixed rate (say 8kHz), the formula for the sampling rate is
x[n + L]
0 13
IFFT
12 24 24
NFFT=256 NCP=64
1. Channel Capacity and Error Correction Coding 2. Block Coding 3. Code Shortening and Puncturing 4. Simulink Implementation of Block Codes 5. Convolutional Codes 6. Simulink Implementation of Convolutional Codes 7. Concatenated Codes in IEEE802.16
1.1 Channel Capacity 1.2 Error Correction Coding 1.3 Minimum SNR Requirement and Shannon Limit
Signal to Noise Ratio (SNR) Bandwidth B and a desired Bit Error Rate (BER), what is the maximum data rate we can transmit?
noise
..01010110
MOD
channel
DEM
..01010010
Errors!
Transmitted
Received
C = B log 2 (1 + SNR )
bits/sec
Significance: if the transmitted data rate R<C then we can always find a coding scheme to make the bit error rate arbitrarily small.
Example:
SNRdB=20dB B=10MHz
Purpose: detect and Correct Errors by adding redundant information. How to Define an Encoder: code rate
rc = Ru <1 Re
rc
Ru
data rate
encoder
Re > Ru
Encoded data rate
rc encoder
channel
C
C
rc decoder
Ru < C
Ru
BER
Given a data rate Ru < C a desired Bit Error Rate (BER) arbitrarily small you can always find a code with coding rate
Ru rc <1 C
with desired BER.
Clearly the Complexity goes up with the coding rate. Example: see two situations with the same BER = 10 5 and
Eb / N 0 4dB
rc = 1 / 2
B. Block Code (65520, 61425) low density parity check, with coding rate r = 61425 = 15
c
65520
16
1/ 2
15 / 16
rc
code rate
-1
3 EbN0 dB
1.6dB
Notice:
Eb > 1.6dB N0
always!!!
2. Block Coding
2.1 Parameters of Block Codes 2.2 Probability of Error 2.3 Reed Solomon Codes (non binary data) 2.3 Simulink Implementation
(n, k , t )
k symbols Code Rate n> k symbols
k rc = n
Parameters:
(n, k , t )
d min 1 t floor 2
Max. number of errors corrected Minimum distance between codewords
where
d min n k + 1
L
D B
t
A
d min
L
codewords non -codewords
receive transmit C A
channel decoder
D where
d (C , A) t d ( D, A) > t
2. Probability of Error If the code corrects up to t errors, the probability that the wrong codeword is decoded is given by
n j d /2 p (1 p ) n j (2 k 1)(4 p (1 p ) ) min Pe j =t +1 j
n
j bits wrong with p the probability of error for one bit. For BPSK, QPSK:
p = Q 2 Ec / N 0
k Eb n
n j Pe n j Pb j p (1 p ) j k j =t +1
n
codeword error
Probability of Error: BPSK coded and uncoded -2 -2.5 -3 -3.5 log10(Prob of error) -4 -4.5 -5 -5.5 -6 -6.5 -7
7 8 Eb/N0 dB
10
11
(n, k , t )
n = 2m 1
2m k t = floor 2
coded symbols
errors corrected
1 symbol = m bits
Good for Burst Error Correction at relatively high SNR
Example: (255,239,8)
239 symbols
RS
=
16
parity
Based on polynomials:
uncoded block
coded block
RS
u[0],..., u[k 1]
u ( X ) = u[0] + u[1] X + ... + u[k 1] X k 1
c[0],..., c[n 1]
c( X ) = c[0] + c[1] X + ... + c[n 1] X n 1
encoder
c( X ) = g ( X )u ( X )
u( X )
errors
g( X )
quotient
e( X )
u( X ) e( X )
remainder
y( X ) g(X )
y ( X ) = c ( X ) + e( X ) = g ( X )u ( X ) + e( X )
1. Code Shortening
Start with a block code, say RS (n=255, k=239, t=8). We can generate a different code by Shortening: 1. Shortened to k data bytes by adding 239-k null symbols 2. At the output eliminate the corresponding 239-k terms
k (k+16,k,8) k 16
00000
(255, 239,8)
16
239 symbols
(k+16,k,8)
16
2. Code Puncturing
By puncturing we eliminate L parity bytes to obtain a code correcting 8-T errors. Therefore we determine L from
parity bytes
(N k ) = 8 T
2
16 L = 8T 2
L = 2T
Puncturing Reed Solomon Codes (k '+16, k ' ,8), 1. The last 16 bytes are parity bytes
Code:
(k+16,k,8)
16
(k '+16 2T , k ' ,8 T )
(k+16,k,8-T)
k 16-2T parity
(k '+16 2T , k ' ,8 T )
k=24, T=4 k=36, T=6 k=48, T=0 k=72, T=4 k=96, T=2 k=108, T=2
Lets implement the code (52,36,8) by shortening 1. Shortened to k=36 data bytes (=36x8=288 bits) by adding 239-k null symbols at the beginning of the block 2. At the output eliminate the first 239-k terms
239 36 = 203
288 bits
36
RS
52
RS Encoder
Raw data 288 bits Encoded data 416 bits
RS Decoder
Raw data 288 bits Received data 416 bits
RS decoder
Select each group of blocks and use Edit > Create Subsystem It cannot be undone!
Masked Subsystems In Simulink we can create customized blocks, where we can enter parameters values. Example: Reed Solomon Encoder and Decoder
datablock data
RS Encoder RS Decoder
n'
encoded data
RS Encoder: 1. edit
[239-k+1:255]
add parameters
RS Decoder:
1. Start with the previous code (52,36,8); 2. Puncture it by eliminating 2T=12 (ie T=6) bytes in the parity
RS (40,36,2) encoder
Sequence Operations>Puncture
same vector
RS (40,36,2) decoder
Insert 12 zeros
Convolutional Encoders
Convolutional Encoders
raw data
L
k
L
M
CC
k n
Rate
L
Coded data
x1
z 1
z 1
z 1
z 1
y2
x2
z 1
z 1
z 1
y3
Polynomial description:
[ y1
y2
y3 ] = [x1
a11 x2 ] a21
a12 a22
a13 a23
y1
x1
1
z 1
0
z 1
0
z 1
1
z 1
1 1
x2
0
z 1
1
z 1
0
z 1
Therefore the code is described by the matrix (all entries are octal)
no connection x1 y3
[ y1
y2
y3 ] = [x1
23 35 0 x2 ] 0 5 13
no connection
x2 y1
The parameters are then: CONSTRAINED_LENGTH = [4,3] CODEGENERATOR=[23,35,0; 0,5,13] which call the function poly2trellis
z 1
z 1
z 1
z 1
z 1
z 1
[ y1 , y2 ] = x[a1 , a2 ]
a1 = (1)8 (111)8 (001)8 = 171 a2 = (1)8 (011)8 (011)8 = 133 constrained length = 7
y2
Note: in some books (as in [Costello]) the binary coefficients are determined in reverse order. Example: the code in the previous page is defined by he polynomials (begin counting from the right) as
Punctured Codes
From an (k,n) convolutional code make a code with higher rate (less correcting capabilities), by periodically eliminating output bits. Example in IEEE 802.16e: The code [171,133] seen before is a (1,2) code:
K, x[n],K
encoder
K , y1[n], y2 [n],K
Rate 2/3:
K, x[n 1], x[n],K K , y1[n 1], y2 [n 1], y1[n], y2 [n],K
encoder
Since:
K , y1[n 1], y2 [n 1], y1[n], y2 [n],K
Rate 3/4:
K, x[n 2], x[n 1], x[n],K K , y1[n 2], y2 [n 2], y1[n 1], y2 [n 1], y1[n], y2 [n],K
encoder
Since:
1 1
K , y1[n 2], y2 [n 2], y1[n 1], y2 [n 1], y1[n], y2 [n],K
1 1
0
Rate 5/6:
K, x[n 4], x[n 3], x[n 2], x[n 1], x[n],K
encoder
K , y1[n 4], y2 [n 4], y1[n 3], y2 [n 3], y1[n 2], y2 [n 2], y1[n 1], y2 [n 1], y1[n], y2 [n],K
Since:
1 1
0 1
1 0
0
1
1 0
K , y1[n 4], y2 [n 4], y1[n 3], y2 [n 3], y1[n 2], y2 [n 2], y1[n 1], y2 [n 1], y1[n], y2 [n],K
Simulink Implementation
It is highly desirable to be able to set the system to a number of different data and coding rates to adapt to channel conditions; IEEE802.16 achieves variable data rates by a combination of mechanisms: coding (shortening, puncturing) data block length (subchannelization) different rates have to be easily achieved by changing appropriate parameters without major reconfigurations.
k
Raw Data in
RS encoder
nRS
CC encoder
n
Encoded Data out
RS parameters
CC parameters
RS Encoder
(k + 16 2T , k ,8 T )
239 255
RS (255,239,8) select
k + 16
puncture
Zero Pad
nRS = k + 16 2T
2T
nRS
CC [171,133]
2nRS
puncture
nRS n= rCC
By combining the two codes we obtain a number of data rates (section 8.3.3.2 of the standard):
Rate ID
MQAM 2 4 4 16 16 64 64
Coding rate k/n 1/2 1/2 3/4 1/2 3/4 2/3 3/4
RS Code
0 1 2 3 4 5 6
36
48
3/4
(40,36,2)
5/6
36
Raw Data in
RS encoder
40
CC encoder
40 = 48 5/6
Encoded Data out
RS parameters
CC parameters
k = 36
pCC = [1,1,0,1,1,0,0,1,1,0]
Rate ID
MQAM
Data block k
(bytes)
pRS
No RS [ones(1,32),zeros(1,8)] [ones(1,40),zeros(1,12)] 1 [ones(1,80),zeros(1,8)] [ones(1,108),zeros(1,4)] [ones(1,120),zeros(1,4)]
pCC
[1,1] [1,1,0,1] [1,1,0,1,1,0,0,1,1,0] [1,1,0,1] [1,1,0,1,1,0,0,1,1,0] [1,1,0,1,1,0] [1,1,0,1,1,0,0,1,1,0]
CC
coding rate
0 1 2 3 4 5 6
2 4 4 16 16 64 64
12 24 36 48 72 96 108
The Coding Rates and the MQAM modulation parameters are designed in such a way that, in all cases
Symbol Block
To IFFT MQAM
bytes:
k
Row Data Block
nRS
Coded Data Block
n
Coded Data Block
In all cases of NFFT=256,512,1024,2048 the number of data symbols transmitted is a multiple of 192.
128 108 20 12 96
IEEE802.16 Implementation
In addition to OFDM Modulator/Demodulator and Coding we need
Time Synchronization: to detect when the packet begins Channel Estimation: needed in OFDM demodulator Channel Tracking: to track the time varying channel (for mobile only)
In addition we need Frequency Offset Estimation: to compensate for phase errors and noise in the oscillators Offset tracking: to track synchronization errors
Basic Structure of the Receiver Channel Estimation: estimate the frequency response of the channel Time Synchronization: detect the beginning of the packet and OFDM symbol
WiMax Demodulator
Time Synchronization In IEEE802.16 (256 carriers, 64 CP) Time and Frequency Synchronization are performed by the Preamble. Long Preamble: composed of 2 OFDM Symbols Short Preamble: only the Second OFDM Symbol First OFDM Symbol Second OFDM Symbol 320 samples 2 repetitions of a long pulse + CP
64
64
64
64
64
64
128
128
Tg
Td
Tg
Td
The standard specifies the Down Link preamble as QPSK for subcarriers between -100 and +100:
1 j , PALL [k ] = 0,
Using the periodicity of the FFT:
k = 100,...,1,+1,...,+100 otherwise
PALL [k ], k = 1,...,100
100
156
255
P4 [k ]
p4 [ n]
L
0
FFT
64 64 64 64
255
252 255
p4 [ n]
64
0
64
64
64
64
255 319
P2 [k ]
p2 [ n]
L
0
FFT
128 128
255
2 4 6
p2 [ n]
64
0
Several combinations for Up Link, Down Link and Multiple Antennas. We can generate a number of preambles as follows: With 2 Transmitting Antennas:
m=0
m = 1,2,3
L
n0
y[n l] y *[n 128 l]
l =0 127 2
y[n]
ry2 [n] =
z 128
xcorr
L
n0
y[n l] y *[n 128 l]
l =0 127 2
Compute Autocorrelation :
y[n]
ry2 [n] =
z 128
xcorr
y[n]
64 128 128
L
n0
128
y[n 128]
64 128
Ln
MAX when
ry2 [n]
n0 64
n0
Compute it in Simulink:
127
y[n]
1 In1 Conj. -128 z Delay u Product Digital Filter DF FIR |u| Abs u 2 Math Function Divide
ry2 [n]
>= 0.8 Compare To Constant 1 Sync
-128 z |u| Abs1 u2 Square DF FIR Delay1 Product1 Digital Filter2 -CConstant MinMax max
ry [n]
64
y[n]
xcorr
p[n]
ryp [n] =
y[n l] p *[l]
l =0
127
Since the preamble is random (almost like white noise), it has a short autocorrelation:
y[n]
64 128 128
L
n0
2 ryp [n]
p[n]
128
127
n0 128
n0
y[n]
xcorr
p[n]
ryp [n] =
y[n l] p *[l]
l =0
127
Since the preamble is random, almost white, recall that the crosscorrelation yields the impulse response of the channel
y[n]
64 128 128
L
n0
| h[n] |
ryp [n]
p[n]
128
127
n0 128
n0
ry
ryp
Synchronization with Dispersive Channel Let L be the length of the channel impulse response
64 L
In order to determine the starting point, compute the energy on a sliding window and choose the point of maximum energy
y[n]
xcorr
p[n]
ryp [n]
c[n] c[n]
Maximum energy
ryp [n] 1
n M +1
n
M=max length of channel = length of CP
c[n] = ryp [n k ]
k =0
M 1
Example
y[n]
xcorr
p[n]
ryp [n]
c[n]
Auto correlation
y[n]
max
Cross correlation
p[n]
c[n]
Detect MAX
Cross correlation
Sum
Channel Estimation
Recall that, at the receiver, we need the frequency response of the channel:
X m [0] X [k ] M m M X m [ N 1]
w[n]
OFDM TX
h[n]
OFDM RX
M M
Ym [0] Ym [k ]
Ym [ N 1]
Transmitted:
X m [k ]
Received:
Ym [k ] = H [k ] X m [k ] + W [k ]
W [k ]
From the Preamble: at the beginning of the received packet. The transmitted signal in the preamble is known at the receiver: after time synchronization, we take the FFT of the received preamble Estimated initial time
Received Preamble:
64
128
128
256 samples
L
Y [ 0] Y [k ]
FFT
Y [255]
Y [k ] = H [k ] X p [k ] + W [k ], k = 0,...,255
Y [k ] = H [k ] X p [k ] + W [k ], k = 0,...,255
Solve for
H [k ]
H [k ] =
Y [k ] X * [k ] preamble
2 | X p [k ] |2 + w
X p [k ] = 0 frequency response H [k ]
X p [k ] = 1 j
Fact: by definition,
if
k = 2,4,...,100 k = 156,158,...,254
X p [k ] = 0
H [k ] =
only for the frequencies k such that
Y [k ] X * [k ] preamble
2 | X p [k ] |2 + w
X p [k ] 0
and interpolate for the other frequencies. This might not yield good results and the channel estimate might be unreliable; known
Linterpolate
k
2. Recall the FFT and use the fact that we know the maximum length L of the channel impulse response
Y [k ] = H [k ] X p [k ] + W [k ]
Since the the preamble is such that either For the indices where
| X p [k ] |= 0
or
| X p [k ] |= 2
| X p [k ] |= 2
we can write:
2 jk n L 1 * N Y [k ] X p [k ] = h[n]e 2 + W [k ] X * [k ] p n =0
for
k = 2,4,...,100 k = 156,158,...,254
so that we have 100 equations and L=64 unknowns. This is solved by a matrix multiplication
h = Finv YX * p
64 1 100 1
Simulink Implementation
h[n]
Y [k ] Data in y[n] X * [k ] p
Example:
NOT TO SCALE
Ch.
Channel Tracking
In mobile applications, the channel changes and we need to track it. IEEE802.16-2005 tracks the channel by embedding pilots within the data. In the FUSC (Full Use of Sub Carriers) scheme, the pilots subcarriers are chosen within the non-null subcarriers as
9k + 3m + 1
with
0 1 4 7L
subcarrier k
OFDM Symbol
nulls DC (null)
Demodulator
Channel tracking
M
TX
M M RX
NT
Transmit Antennas
NR
NT N R
Receive Antennas
Different paths Two cases: 1. Array Gain: if all paths are strongly correlated to which other the SNR can be increased by array processing; 2. Diversity Gain: if all paths are uncorrelated, the effect of channel fading can be attenuated by diversity combining
Receive Diversity:
h1
y1
M RX
TX
s
NT = 1
Transmit Antennas
hN R
yNR
NR
Different paths
NR
Receive Antennas
w1 y1 h1 M = M ES s + N 0 M wN y N hN R R R
Energy per symbol Noise PSD
Assume we know the channels at the receiver. Then we can decode the signal as
y = hi* yi = ES | hi |2 s + N 0 hi* wi
i =1 i =1 i =1
NR
NR
NR
signal
and the Signal to Nose Ratio
noise
NR 2 ES SNR = | hi | N i =1 0
In the Wireless case the channels are random, therefore Now there are two possibilities:
| h |
i =1 i
NR
is a random variable
1. Channels strongly correlated. Assume they are all the same for simplicity
h1 = h2 = ... = hN R = h
Then
2 | hi |2 = N R | h |2 = N R 2 NR
assuming
E | h |2 = 1
{ }
i =1
and
ES 1 2 ES SNR = N R | h | = NR 2 N0 2 N0
2
mSNR = E{SNR} = N R
ES N0
better on average
SNR
N R ES = var{SNR} = 2 N0
var =
SNR
mSNR
1 = 2
y = x + x + ... + x
2 1 2 2
2 n
Then with
2 y = n
E{ y} = n var{ y} = 2n
y =| x1 |2 + | x2 |2 +...+ | xn |2
xi = ai + jbi CN (0,1) complex gaussian, i.i.d .
Then with
y=
1 2 2n 2 E{ y} = n
1 var{ y} = n 2
Since:
NR 2 ES SNR = | hi | N i =1 0 NR 1 2 2 | hi | = 2 2 N R i =1
1 2 ES SNR = 2 N R N0 2
Diversity of order N R
with
E{SNR} = N R
var{SNR} =
ES N0
N R ES 2 N0
var =
SNR
mSNR
1 2 NR
N R = 10 NR = 2 NR = 1
20
40
60
80
100
120
140
160
180
200
Transmitter Diversity
h1
M
y
RX
TX M
hN R
NT
Transmit Antennas
NR = 1
NT
Different paths Receive Antennas
ES y= N T
hi s + N 0 w i =1
NT
However there is a gain if we use Space Time Coding. Take the case of Transmitter diversity with two antennas
h1
x1[n]
TX
y[n]
h2
RX
x2 [ n ]
Given two sequences
s1[n], s2 [n]
* 2
x1 x2
s1 s2
* s1
2n 2n + 1
y[2n] y *[2n + 1] =
To decode, notice that
ES 2
h1 h* 2
h2 s1 w1 + N0 * * h1 s2 w2
z1 h1* z = * 2 h2
s h2 y[2n] ES 2 1 * = 2 || h || s + h1 y [2n + 1] 2
% w1 N 0 || h || % w2
with
2 / ES K= | h1 |2 + | h2 |2 +2 N 0 / ES
s1 s2
ES || h ||2 2
% N 0 || h || w1
z1 z2
% N 0 || h || w2
1 2 || h || =| h1 | + | h2 | = 4 2
2 2 2
ES || h ||2 2
|| h ||2 ES SNR = 2 N0
Apart from the factor , it has the same SNR as the receive diversity of order 2.
WiMax Implementation
h1
h2
Base Station
Subscriber Station
Down Link (DL): BS -> SS Transmit Diversity Uplink (UL): SS->BS Receive Diversity
Down Link: Transmit Diversity Use Alamouti Space Time Coding: Transmitter: Data in
Error Coding
Xn
M-QAM buffer
X 2m
STC
IFFT
TX
IFFT
TX
X 2 m 1
Block to be transmitted Space Time Coding
X 2m X 2 m 1
* X 2 m 1 * X 2m
2m
2m + 1
time
Receiver:
Y2 m
Data out Error Correction
Xn
M-QAM
X 2m
Unbuffer STD
FFT
RX
X 2 m 1
Space Time Decoding: For each subcarrier k compute:
FFT
RX
Y2 m +1
X 2 m [k ] = K H1*[k ]Y2 m [k ] + H 2 [k ]Y2*m +1[k ] X [k ] = K H *[k ]Y [k ] H [k ]Y * [k ]
2 m 1
2m
2 m +1
with
K=
2 / ES | H1[k ] |2 + | H 2 [k ] |2 +2 N 0 / ES
The two antennas transmit two preambles at the same time, using different sets of subcarriers
p0 [ n ]
CP 64
0
+
128
319
n
100
L
0
L
100
p1[n]
CP 64
128
128
+
128
ODD subcarriers
time
frequency
n = 128,...,319
p0 [ n ]
h0 [n]
y[n]
p1[n]
Problems: time synchronization
h1[n]
y[n]
64 256
z 128
n0
e j 3
e j1
Rayleigh
x1[n]
T T
y1[n]
T T
x2 [ n ]
e j 4
Rayleigh
y 2 [ n]
e j 2
= [ 1 L N ] sec
P = [ P L PN ] dB 1
IFFT
DAC
I
Q
P/S
DAC
MOD
BPF
MOD
BPF
FIF
oscillator
FC FIF
FIF
oscillator
FC FIF
DEM
BPF
FFT
ADC
I Q
LPF LPF
S/P
ADC
DEM
BPF
Problems!!!
IFFT
DAC
I Q
P/S
DAC
MOD
BPF
MOD
BPF
FIF
oscillator Peak to Average Power Ratio Frequency Drift
FC FIF
Peak to Average Power Ratio (PAR) A Single Carrier QPSK signal has a constant amplitude, since only the phase is modulated. A Multi Carrier OFDM signal has a random amplitude. Example: see an OFDM signal with 1024 subcarriers. Plot 1,000 OFDM symbols
0.015
Pmax=0.014
0.01
0.005
Pave=2e-4
0 0 2 4 6 8 10 12 x 10
5
Pmax/Pave=66.88=18dB
Effects: On the ADC: larger number of bits to accommodate large dynamics On the Power Amplifier: it has to be linear within a wider range
Remedies: the signal needs to be clipped to avoid saturating the amplifier the output power of the signal has to be reduced
Cause of large peaks: OFDM signal is a sum of sinusoids. When all in phase, the sum can be large (peak value) with respect to the average.
1 y[n] = N
Y [k ]e
k =0
N 1 k =0
N 1
jk 2N n
Average Power:
1 E | y[n] |2 = 2 N
E | Y [ k ] |2 =
1 E | Y [ k ] |2 N
}
2
E | y[n] | Y [k ] =| Y | Y
2
PPeak N PAve
By the Central Limit Theorem the received signal y[ n] is gaussian The amplitude is Rayleigh distributed and the power is Chi-square. Therefore we can compute the Cumulative Density Function analytically:
Pr {PAR > z} = 1 (1 e
fairly accurate for number of carriers
z 2.8 N
N 64
-1
N=128,256,512,1024
-2
-3
-4
-5
-6
-7 2
10
12
14
z dB
Notice: 1. The probability that PAR=N, the number of subcarriers, is almost zero; 2. The probability that PAR>4=12dB is of the order of
10 4.5 10 3.5
Remedies: 1. Data randomizing: if there is an error due to PAR, resend the data and most likely it will be fine 2. Clipping: easy thing to do, at the expenses of introducing errors 3. Coding: potentially the best, but still not reliable solutions (not in the standard) 4. A number of iterative techniques: too complex for real time implementation
vin [n]
vout (t )
DAC
vin [n]
vout (t )
ZOH
QCL
In the DAC there are two sources of errors: Quantization Error; Saturation error due to clipping
VMAX VMAX
Vmin
t
Small clipping error, Large Quantization Noise
Vmin
Large clipping error, Small Quantization Noise
We choose Clipping Level for best compromise between clipping error and quantization noise.
vin [n]
vout (t )
DAC
ideal
vin [n]
vout (t )
ZOH
QCL
Total SNR due to Q and CL: SNR due to Q :
1 Q
1 1 CL
3 2 /2
where
= E { x[n] |2 } |
b = number of bits per sample
= ACLIP /
= ACLIP / = 4 5
65
SNR( dB )
60 55 50 45 40 35 30 25 20 15 2 3 4 5 6 7 8
b = 12 b = 11 b = 10 b=9 b=8
number of bits
= ACLIP /
x(t )
g
g ( x) =
y (t ) = g ( x(t ) )
(1 + x )
2p
Pout
1 2p
p of the order of 3
Pave PMAX
Pin
Ideally you want the Input Back Off (IBO) to be larger than the PAR.
IBO = 10 log10
PAR 10log10 N
This can be excessive and very inefficient. Example: with N=256 carriers you need a IBO of
Remedies: Clipping
x[n]
clip
| x[n] |
A
FT time wide band noise
time
frequency
~[n] = a e ji [n n ] x i i
i
| x[n] |
A
time
ni
x[n]
clip Filter
X (F )
~ X (F )
x[n] ai e ji w[n ni ]
i
W (F )
F
It has two effects: 1. Additive Noise in the demodulated subcarriers 2. It generates out of band noise, so we need to add a Low Pass Filter The latter is not allowed, since it interferes with neighboring channels.
Example: See one of OFDM symbol with the following parameters (this is not random but chosen with high PAR): FFT length N=256 Data Carriers: Nused=200 Modulation: 4QAM Large peak value
0.4
| x[n] |
50
100
150
200
250
300
Clip it to 5dB (no filtering): See the Frequency Spectrum: nulls data nulls
f = F FS
1 Nused / 2 N 2
5
0
unfiltered clipped signal
Nused / 2 N
1 2
-5
-10
-15
-20
-25 -0.5
-0.4
-0.3
-0.2
-0.1
0.1
0.2
0.3
0.4
0.5
f pass
In matlab: use firpm
f stop
0 .5
h[n]
1.2
FT of window
| H( f )|
10
0.8
-10
0.6
-20
0.4
-30
0.2
-40
-50
-0.2 -15
-10
-5
10
15
-60 -0.5
-0.4
-0.3
-0.2
-0.1
0.1
0.2
0.3
0.4
0.5
filtered and unfiltered clipped signal 10 0 -10 -20 -30 dB -40 -50 -60 -70 -80 -0.5
-0.4
-0.3
-0.2
-0.1
0 F/Fs
0.1
0.2
0.3
0.4
0.5
1.5
0.5
-0.5
-1
-1.5 -1.5
-1
-0.5
0.5
1.5
Peak Cancellation Detect and Cancel the peak to reduce out of band noise.
| x(t ) |
(x(t ) Ae
0
t0
j x ( t 0 )
) (t t )
0
(x(t ) Ae
0
j x ( t 0 )
)g (t t )
0
Effects: The LPF completely controls the out of band noise. It can be completely eliminated; It reduced PAR and therefore the Input Back Off. It causes an increase of in band noise and therefore a higher BER.
y[n ] = Y [k ]e
jk 2N n
= y I [n ] + jyQ [n ]
y [n ] = AI e j I y I [n ] + jAQ e
jQ
yQ [n ]
= Ae j ( (1 + )e j y I [n ] + j (1 )e j yQ [n ])
with
A=
AI + AQ 2 I + Q 2
= =
AI AQ AI + AQ
I Q I + Q
(1 + )e j (1 + )(1 + j ) 1 + + j (1 )e j (1 )(1 j ) 1 j
After a bit of algebra:
y [n ] = Ae j ( y[n ] + ( + j ) y *[n ])
Substitute: to obtain:
y[n ] = Y [k ]e
k =0
N 1
jk 2N n
N 1 N 1 jk 2N n jl 2N n * + ( + j ) Y [l]e y [n ] = Ae Y [k ]e l =0 k =0 j
N 1 jk 2N n * = Ae (Y [k ] + ( + j )Y [ N k ]) e k =0
Y [k ]
Y [N k ]
N k
+ j
It is as having extra noise added to the signal: I/Q Imbalance
y[n ]
L
noise
The factor | + j | is called Negative Frequency Rejection and it can be modeled as covariance of additive noise.
I/Q Imbalance
w2 [n]
y[n ]
Define:
y[n]
2 y SNRi = 10 log 2 i
w1[n]
noise
Implementation Loss:
SNR1 SNR2 10
Example: let
10 log 1 + 10
2035 10
) = 0.135
Total SNR:
Frequency Synchronization
Drifts and errors in the oscillator frequencies cause a frequency offset, like a doppler shift; This causes loss of subcarriers orthogonality and Inter Carrier Interference (ICI). The effect of ICI can be modeled as additive noise, which can be quantified
30
SNR
25
20 dB 15 10 5 0
0.02
0.04 epsilon
0.06
0.08
0.1
x[n]
CP
xP
N = 128
xP
N = 128
n0
If there is a frequency offset (due to oscillator drifts or doppler shift) the received signal has an extra phase term
y[n ] = y0 [n ]e j 2 f n
with f the digital frequency offset. Take the two received parts of the long preamble:
y1[n ] = y0 [n ]e j ( 2 f n + ) + w1[n ] y2 [n ] = y0 [n ]e j(
2 f ( n + N ) + )
+ w2 [n ]
n = 0,..., N 1
y2 = y1e j 2f N + w
where Then:
* * y1 T y2 =|| y1 ||2 e j 2 f N + y1 T w
yi = [ yi [0] L yi [ N 1]]
Since,
f <
1 2N