Simulation of Wireless Communication Systems Using MATLAB
Simulation of Wireless Communication Systems Using MATLAB
Fall 2007
P a r is E CE 73 2 1
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Outline
MATLAB Simulation
P a r is E CE 73 2 2
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
MATLAB Simulation
P a r is E CE 73 2 3
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
System to be Simulated
Sampler,
N (t )
rate f s
bn s (t ) R (t ) R [n ] to
× p( t ) × h( t ) + Ts
(t )
DSP
d ( t - nT ) A
P a r is E CE 73 2 4
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 5
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Sampler,
N (t )
rate f s
bn s (t ) R (t ) R [n ]
to
× p( t ) × h( t ) + Ts
(t )
DSP
d ( t - nT ) A
P a r is E CE 73 2 6
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
N [n ]
bn R [n ]
× fs T h [n ] + to DSP
P a r is E CE 73 2 7
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Sampler,
N (t )
rate f s
bn s (t ) R (t ) R [n ]
to
× p( t ) × h( t ) + Ts
(t )
DSP
d ( t - nT ) A
P a r is E CE 73 2 8
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
1 ( n + 1 ) Ts
h [n ] = p ( t ) * h ( t ) dt
Ts nT s
h [n ] ˜ p ( t ) * h ( t )| ( n + 1 ) T
2 s
P a r is E CE 73 2 9
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
1.5
0.5
0
0 0.2 0.4 0.6 0.8 1
Time/T
P a r is E CE 73 2 10
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 11
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
E s = ss2 · A2 | p ( t ) * h ( t )| 2 dt
P a r is E CE 73 2 12
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 13
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Listing : SimpleSetParameters.m
3 % This script sets a structure named Parameters to be used by
% the system simulator.
%% Parameters
% construct structure of parameters to be passed to system simulator
8 % communications parameters
Parameters.T = 1/10000; % symbol period
Parameters.fsT = 8; % samples per symbol
Parameters.Es = 1; % normalize received symbol energy to 1 (0dB)
Parameters.EsOverN0 = 6; % Signal-to-noise ratio (Es/N0)
13 Parameters.Alphabet = [1 -1]; % BPSK
Parameters.NSymbols = 1000; % number of Symbols
P a r is E CE 73 2 14
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 15
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 16
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 17
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
R [n ] bˆn
h * [- n ] fs T Slicer
P a r is E CE 73 2 18
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 19
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
D MF I nput
4 00
2 00
-2 00
-4 00
0 1 2 3 4 5 6 7 8 9 10
Tim e (1/ T)
D M F Out put
15 00
10 00
5 00
-5 00
-10 00
0 1 2 3 4 5 6 7 8 9 10
Tim e (1/ T)
P a r is E CE 73 2 20
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
D M F Input
300
200
100
-100
-200
500
-500
P a r is E CE 73 2 21
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Slicer
P a r is E CE 73 2 22
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 23
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Entire System
P a r is E CE 73 2 24
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Listing : MCSimple.m
%% simulate discrete-time equivalent system
% transmitter and channel via toolbox functions
Symbols = RandomSymbols( NSymbols, Alphabet, Priors );
38 Signal = A * LinearModulation( Symbols, hh, fsT );
if ( isreal (Signal) )
Signal = complex(Signal);% ensure Signal is complex-valued
end
Received = addNoise( Signal, NoiseVar );
43
% digital matched filter and slicer
MFOut = DMF( Received, hh, fsT );
Decisions = SimpleSlicer( MFOut(1:NSymbols), Alphabet, Scale );
48 %% Count errors
NumErrors = sum ( Decisions ~= Symbols );
P a r is E CE 73 2 25
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 26
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
43 while ( ~Done )
NumErrors(kk) = NumErrors(kk) + MCSimple( Parameters );
NumSymbols(kk) = NumSymbols(kk) + Parameters.NSymbols;
P a r is E CE 73 2 27
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Confidence Intervals
P a r is E CE 73 2 28
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Confidence Intervals
More specifically, we want a high probability p c
(e.g.,
pc = 95%) that | Pˆ e - P e | < s c .
The parameter s c is called the confidence interval ;
it depends on the confidence level p c , the error probability
P e , and the number of transmitted symbols N.
It can be shown, that
Pe ( 1 - Pe )
sc = z c ·
N,
P a r is E CE 73 2 29
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 30
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
A Better Stop-Criterion
When simulating communications systems, the error rate is
often very small.
Then, it is desirable to specify the confidence interval as a
fraction of the error rate.
The confidence interval has the form s c
= ac · Pe (e.g.,
ac = 0.1 for a 10% acceptable estimation error).
Inserting into the expression for N and rearranging terms,
P e · N = ( 1 - P e ) · ( zc / ac ) 2 ˜ ( zc / ac )2 .
P a r is E CE 73 2 31
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Listing : MCSimpleDriver.m
9 % comms parameters delegated to script SimpleSetParameters
SimpleSetParameters;
% simulation parameters
EsOverN0dB = 0:0.5:9; % vary SNR between 0 and 9dB
14 MaxSymbols = 1e6; % simulate at most 1000000 symbols
P a r is E CE 73 2 32
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Listing : MCSimpleDriver.m
for kk = 1: length ( EsOverN0dB )
32 % set Es/N0 for this iteration
Parameters.EsOverN0 = dB2lin( EsOverN0dB(kk) );
% reset stop condition for inner loop
Done = false;
37 % progress output
if (Verbose)
disp ( sprintf ( ’Es/N0: %0.3g dB’, EsOverN0dB(kk) ) );
end
P a r is E CE 73 2 33
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Simulation Results
10 -1
10 -2
-3
10
10 -4
10 -5
-2 0 2 4 6 8 10
E /N ( dB)
s 0
P a r is E CE 73 2 34
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
Summary
P a r is E CE 73 2 35
Di s c r et e- Ti m e E qui v ale nt S y s t em
M AT LA B S im u lat io n
Di git al M at c he d Fi lt er and S l ic er
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M on te C ar lo S i mu lat io n
P a r is E CE 73 2 36
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Outline
MATLAB Simulation
P a r is E CE 73 2 37
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 38
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 39
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 40
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Equalization
P a r is E CE 73 2 41
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 42
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 43
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
The criterion
N
D 2 = | r [n ] - s [n ] * h [n ]|2 .
n
P a r is E CE 73 2 44
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
MATLAB Simulation
P a r is E CE 73 2 45
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Listing : VASetParameters.m
Parameters.T = 1/1e6; % symbol period
Parameters.fsT = 8; % samples per symbol
Parameters.Es = 1; % normalize received symbol energy to 1 (0dB)
Parameters.EsOverN0 = 6; % Signal-to-noise ratio (Es/N0)
13 Parameters.Alphabet = [1 -1]; % BPSK
Parameters.NSymbols = 500; % number of Symbols per frame
% channel
Parameters.ChannelParams = tux(); % channel model
23 Parameters.fd = 3; % Doppler
Parameters.L = 6; % channel order
P a r is E CE 73 2 46
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
MATLAB Simulation
Listing : MCVA.m
41 % transmitter and channel via toolbox functions
InfoSymbols = RandomSymbols( NSymbols, Alphabet, Priors );
% insert training sequence
Symbols = [ InfoSymbols(1:TrainLoc) TrainingSeq ...
InfoSymbols(TrainLoc+1: end )];
46 % linear modulation
Signal = A * LinearModulation( Symbols, hh, fsT );
P a r is E CE 73 2 47
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
MATLAB Simulation
P a r is E CE 73 2 48
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
MATLAB Simulation
% channel estimation
57 MFOutTraining = MFOut( 2*TrainLoc+1 : 2*(TrainLoc+TrainLength) );
ChannelEst = EstChannel( MFOutTraining, TrainingSeq, L, 2);
P a r is E CE 73 2 49
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Channel Estimation
Channel Estimate:
hˆ = ( S S ) - 1 ·Sr,
where
S is a Toeplitz matrix constructed from the training
sequence, and
r is the corresponding received signal.
P a r is E CE 73 2 50
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
10- 1
-2
10
10- 3
-4
10
10- 5
10
-6 Si m ul ated V A
L=1
L=2
L=3
10- 7
L=4
L=5
AW GN
-8
10
0 2 4 6 8 10 12
E /N (dB )
s 0
P a r is E CE 73 2 51
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Conclusions
The simulation indicates that the wide-band system with
equalizer achieves a diversity gain similar to a system with
transmitter diversity of order 2.
The ratio of delay spread to symbol rate is 2.
comparison to systems with transmitter diversity is
appropriate as the total average power in the channel taps
is normalized to 1.
Performance at very low SNR suffers, probably, from
inaccurate estimates.
Higher gains can be achieved by increasing bandwidth.
This incurs more complexity in the equalizer, and
potential problems due to a larger number of channel
coefficients to be estimated.
Alternatively, this technique can be combined with
additional diversity techniques (e.g., spatial diversity).
P a r is E CE 73 2 52
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
P a r is E CE 73 2 53
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Time Diversity
Time diversity: is created by sending information multiple
times in different frames.
This is often done through coding and interleaving.
This technique relies on the channel to change sufficiently
between transmissions.
The channel’s coherence time should be much smaller than
the time between transmissions.
If this condition cannot be met (e.g., for slow-moving
mobiles), frequency hopping can be used to ensure that the
channel changes sufficiently.
The diversity gain is (at most) equal to the number of
time-slots used for repeating information.
Time diversity can be easily combined with frequency
diversity as discussed above.
The combined diversity gain is the product of the individual
diversity gains.
P a r is E CE 73 2 54
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
OFDM
P a r is E CE 73 2 55
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
MIMO
We have already seen that multiple antennas at the
receiver can provide both diversity and array gain.
The diversity gain ensures that the likelihood that there is
no good channel from transmitter to receiver is small.
The array gain exploits the benefits from observing the
transmitted energy multiple times.
If the system is equipped with multiple transmitter
antennas, then the number of channels equals the product
of the number of antennas.
Very high diversity.
Recently, it has been found that multiple streams can be
transmitted in parallel to achieve high data rates.
Multiplexing gain
The combination of multi-antenna techniques and OFDM
appears particularly promising.
P a r is E CE 73 2 56
I nt r odu c ti on to E q ual iz at io n
M AT LA B S im u lat io n
M AT LA B S im ul at ion
Fr e que nc y Div er s i ty : W ide - B and S i gna ls
M or e W ay s t o Cr e at e Div er s i ty
Summary
P a r is E CE 73 2 57