Simulation Model

25
Simulation Model file 1.m It will be useful to provide a simple Matlab/Octave example simulating a BPSK transmission and reception in Rayleigh channel. The script performs the following (a) Generate random binary sequence of +1′s and -1′s. (b) Multiply the symbols with the channel and then add white Gaussian noise. (c) At the receiver, equalize (divide) the received symbols with the known channel (d) Perform hard decision decoding and count the bit errors (e) Repeat for multiple values of and plot the simulation and theoretical results Figure: BER plot of BPSK in Rayleigh fading channel When compared to the AWGN case, around 25dB degradation due to the multipath channel (at the point). This is both good and

Transcript of Simulation Model

Page 1: Simulation Model

Simulation Model file 1.m

It will be useful to provide a simple Matlab/Octave example simulating a BPSK transmission and reception in Rayleigh channel. The script performs the following

(a) Generate random binary sequence of +1′s and -1′s.

(b) Multiply the symbols with the channel and then add white Gaussian noise.

(c) At the receiver, equalize (divide) the received symbols with the known channel

(d) Perform hard decision decoding and count the bit errors

(e) Repeat for multiple values of and plot the simulation and theoretical results

Figure: BER plot of BPSK in Rayleigh fading channel

When compared to the AWGN case, around 25dB degradation due to the multipath channel (at the point). This is both good and bad: bad because we need to spend so much energy to get a reliable wireless link up (in this era of global warming), and good because we signal processing engineers are trying to figure out ways for improving the performance.

Page 2: Simulation Model

Transmitter and receiver:

we had discussed that MSK uses two frequencies which are separated by and phase discontinuity is avoided in symbol boundaries. In that post, we had discussed MSK as a continuous phase transmit signal and showed that phase changes through 0, 90, 180 and 270 degrees. In this post, we will discuss MSK transmission as a variant of offset-QPSK technique. Further, we will discuss the receiver structure and show that bit error rate with coherent demodulation of MSK (using time) is equivalent to that of BPSK modulation. The channel assumed is AWGN.

MSK transmitter

Using bit-sequence and the explanation provided in the excellent paper Minimum shift keying: A spectrally efficient modulation Subbarayan Pasupathy, IEEE Communications Magazine, July 1979 as a reference, let us proceed as follows:

a) Consider a 8 bit sequence which is BPSK modulated as [+1, +1, -1, -1, -1, +1, +1 , +1] having symbol duration of .

b) The same sequence can be sent over QPSK modulation, where even bits are send on I-arm and the odd bits are send over Q-arm. To keep the same data rate, the bits on the I/Q arm are send for

symbol periods.

Figure: Transmission of BPSK/QPSK modulation

c) Now, a variant of QPSK called offset-QPSK (O-QPSK) can be generated by having a relative delay between the I-arm and Q-arm by symbol period .

Page 3: Simulation Model

Note: The advantage of O-QPSK is that phase of the signal can jump at a maximum of only 90 degrees (when compared to 180 degrees in QPSK). Having a smaller phase jump ensures that the spectrum of the waveform is cleaner even when there are distortions in the transmitter.

d) Researchers have found that they can make the phase transitions zero, if rectangular pulse

shapes used in O-QPSK are replaced by sinusoidal pulse shapes i.e by using and

on the I and Q arm respectively. This is also known as Minimum Shift Keying (MSK) !

Figure: Transmission of O-QPSK/MSK modulation

Assuming that the carrier frequency is , the MSK transmission can be written as

,

where

are the even pulse sequence (send on the I arm) and

are the odd pulse sequence (send on the Q arm).

Using trigonometric identities, the above equation can also be written as,

Page 4: Simulation Model

,

where

and

.

We can see that MSK can indeed be visualized as a form of frequency shift keying (FSK), where

the two frequencies are and .

Note: This equation is comparable to that described in the post Simulating MSK transmission

The MSK transmitter block diagram is shown below

Figure: Block diagram of MSK transmitter

MSK Receiver

The receiver for the MSK transmission can be constructed as follows:

a) Down convert the RF signal to I and Q arms by I/Q down conversion

b) Multiply the I and Q arms by and respectively

c) Integrate over the a period of

d) On I arm, perform hard decision decoding on the integrator output at every to get the even bits

Page 5: Simulation Model

e) On Q arm, delay by time , perform hard decision decoding on the integrator output at every to get the odd bits

The block diagram is shown below:

Figure: MSK receiver block diagram

Simulation Model

The Matlab/Octave script performs the following

(a) Generate random binary sequence of +1’s and -1’s.

(b) Group them into even and odd symbols

(c) Perform rectangular pulse shaping on the even and odd symbols, delay the odd symbols by

(d) Multiply the even and odd symbols by and respectively and transmit

(e) Add additive white Gaussian noise (AWGN) for the given value of

(f) Multiply the I and Q arm by and respectively and integrate over period

(g) Using the I arm, recover even bits by performing hard decision decoding on integrator output every time

(h) Using the Q arm, recover even bits by performing hard decision decoding on integrator output delayed by time every time

(i) Count the bit errors

(j) Repeat for multiple values of and plot the simulation and theoretical results.

Page 6: Simulation Model

Figure: BER plot for MSK transmission/reception in AWGN channel

Observations

1./ The BER with MSK is identical to BER with BPSK modulation. This is because MSK demodulation in the above simulation is performed by integrating the received symbol over time

.

2./ Note that it is indeed possible to demodulate MSK by observing only over time and

demodulate it as a FSK with two carriers at and . If such a demodulation is performed, then the BER with MSK will be 3dB poorer (comparable to FSK demodulation) when compared to BPSK modulation.

File3.m

Simulating Minimum Shift Keying Transmitter:

Minimum shift keying (MSK) is an important concept to learn in digital communications. It is a form of continuous phase frequency shift keying . In minimum phase shift keying, two key concepts are used.

(a) The frequency separation of the sinusoidals used for representing bits 1′s and 0′s are , where is the symbol period.

(b) It is ensured that the resulting waveform is phase continuous.

Page 7: Simulation Model

Motivation of continuous phase

we have understood that the minimum frequency separation for two sinusoidals having zero

phase difference to be orthogonal is , where is the symbol period. However, it can be observed that at each symbol boundary, there is a phase discontinuity. The presence of phase discontinuities can result in large spectral side lobes outside the desired bandwidth. Hence the need for having a frequency modulated signal which is phase continuous.

Phase growth in MSK

To ensure continuous phase, the phase of the carrier of the MSK signal is

, where

is the symbol period,corresponds to -1 for bit 0, +1 for bit 1 respectively.

The corresponding carrier signal is.

Figure: Phase transition diagram for MSK

File4.m

bit error probability for coherent demodulation of binary Frequency Shift Keying (BFSK) along with a small Matlab code snippet.

Page 8: Simulation Model

Using the definition provided in Sec 4.4.4 of in binary Frequency shift keying (BFSK), the bits

0′s and 1′s are represented by signals and having frequencies and respectively, i.e.

,

where

is the energy ,

is the symbol duration and

is an arbitrary phase (assume to be zero).

The two frequencies and are orthogonal, i.e.

and

.

Simple transmit-receive block diagram for binary frequency shift keying (FSK) can be as shown below.

Figure: Block diagram of FSK modulation and coherent demodulation

Page 9: Simulation Model

For analyzing the bit error rate with coherent FSK demodulation, let us compare the signaling waveform used by binary FSK when compared with binary PSK. The distance between the energy of the signaling waveform for:

(a) binary phase shift keying (BPSK) is (uses antipodal signaling)

(b) binary frequency shift keying (BFSK) is (uses orthogonal signaling)

Figure: Orthogonal and antipodal signaling

Using similar mathematical formulation used for BPSK, but with the distance between the signals reduced by half, the bit error probability for coherent binary frequency shift keying is

.

For obtaining the same bit error rate as BPSK, binary frequency shift keying requires around 3dB

more . More details on the bit error curves with orthogonal and antipodal signals is discussed in Sec 3.2.5

Simulation Model

The code performs the following:

Page 10: Simulation Model

(a) Generation of random 1′s and 0′s

(b) Converting bits to appropriate frequency

(c) Passing through Additive White Gaussian Noise channel

(d) Demodulation at the receiver

(e) Counting the number of errors.

Figure: Bit error probability with coherent demodulation of frequency shift keying

File5.m

Finding the symbol error probability for a QPSK (4-QAM) modulation scheme.

Page 11: Simulation Model

Figure: Constellation plot for QPSK (4-QAM) constellation

The scaling factor of is for normalizing the average energy of the transmitted symbols to 1, assuming that all the constellation points are equally likely.

Noise model

Assuming that the additive noise follows the Gaussian probability distribution function,

with and .

Computing the probability of error

Consider the symbol

The conditional probability distribution function (PDF) of given was transmitted is:

.

Page 12: Simulation Model

Figure: Probability density function for QPSK (4QAM) modulation

As can be seen from the above figure, the symbol is decoded correctly only if falls in the area in the hashed region i.e.

.

Probability of real component of greater than 0, given was transmitted is (i.e. area outside the red region)

, where

the complementary error function, .

Similarly, probability of imaginary component of greater than 0, given was transmitted is (i.e. area outside the blue region).

.

The probability of being decoded correctly is,

.

Total symbol error probability

The symbol will be in error, it atleast one of the symbol is decoded incorrectly. The probability of symbol error is,

.

For higher values of , the second term in the equation becomes negligible and the probability of error can be approximated as,

.

Simulation Model

Simple Matlab/Octave script for generating QPSK transmission, adding white Gaussian noise

and decoding the received symbol for various values.

Page 13: Simulation Model

Figure: Symbol Error Rate for QPSK (4QAM) modulation

Observations

1. Can see good agreement between the simulated and theoretical plots for 4-QAM modulation

2. When compared with 4-PAM modulation, the 4-QAM modulation requires only around 2dB

lower for achieving a symbol error rate of .

File6.m

Bit error rate simulations using OFDM (Orthogonal Frequency Division Multiplexing) modulation. In this post, we will discuss a simple OFDM transmitter and receiver, find the relation between Eb/No (Bit to Noise ratio) and Es/No (Signal to Noise ratio) and compute the bit error rate with BPSK.

OFDM modulation

Let us use the OFDM system loosely based on IEEE 802.11a specifications.

Parameter Value

FFT size. nFFT 64

Number of used subcarriers. nDSC 52

FFT Sampling frequency 20MHz

Page 14: Simulation Model

Subcarrier spacing 312.5kHz

Used subcarrier index {-26 to -1, +1 to +26}

Cylcic prefix duration, Tcp 0.8us

Data symbol duration, Td 3.2us

Total Symbol duration, Ts 4us

Cyclic prefix

In an OFDM transmission, we know that the transmission of cyclic prefix does not carry ‘extra’ information in Additive White Gaussian Noise channel. The signal energy is spread over time

whereas the bit energy is spread over the time i.e.

.

Simplifying,

Frequency spread

In OFDM transmission, all the available subcarriers from the DFT is not used for data transmission. Typically some subcarriers at the edge are left unused to ensure spectrum roll off. For the example scenario, out of the available bandwidth from -10MHz to +10MHz, only subcarriers from -8.1250MHz (-26/64*20MHz) to +8.1250MHz (+26/64*20MHz) are used.

This means that the signal energy is spread over a bandwidth of 16.250MHz, whereas noise is spread over bandwidth of 20MHz (-10MHz to +10MHz), i.e.

Simplifying,

.

Relation between Eb/No and Es/No in OFDM

Combining the above two aspects, the relation between symbol energy and the bit energy is as follows:

.

Expressing in decibels,

Page 15: Simulation Model

.

Simulation model

The attached Matlab/Octave simulation script performs the following:

(a) Generation of random binary sequence

(b) BPSK modulation i.e bit 0 represented as -1 and bit 1 represented as +1

(c) Assigning to multiple OFDM symbols where data subcarriers from -26 to -1 and +1 to +26 are used, adding cyclic prefix, concatenation of multiple symbols to form a long transmit sequence

(d) Adding White Gaussian Noise

(e) Grouping the received vector into multiple symbols, removing cyclic prefix, taking the desired subcarriers

(f) Demodulation and conversion to bits

(g) Counting the number of bit errors

Figure: Bit Error Rate plot for BPSK using OFDM modulation

Page 16: Simulation Model

Can observe that the simulated bit error rate is in good agreement with the theoretical bit error rate for BPSK modulation i.e.

.

File7.m

MIMO with Zero Forcing equalizer

We had discussed three Single Input Multiple Output (SIMO also known as receive diversity) schemes – Selection combining, Equal Gain Combining, Maximal Ratio Combining and a Multiple Input Single Output (MISO, also known as transmit diversity) scheme – Altamonte 2×1 STBC. Let us now discuss the case where there a multiple transmit antennas and multiple receive antennas resulting in the formation of a Multiple Input Multiple Output (MIMO) channel. In this post, we will restrict our discussion to a 2 transmit 2 receive antenna case (resulting in a 2×2 MIMO channel). We will assume that the channel is a flat fading Rayleigh multipath channel and the modulation is BPSK.

2×2 MIMO channel

In a 2×2 MIMO channel, probable usage of the available 2 transmit antennas can be as follows:

1. Consider that we have a transmission sequence, for example

2. In normal transmission, we will be sending in the first time slot, in the second time slot, and so on.

3. However, as we now have 2 transmit antennas, we may group the symbols into groups of two. In the first time slot, send and from the first and second antenna. In second time slot, send

and from the first and second antenna, send and in the third time slot and so on.

4. Notice that as we are grouping two symbols and sending them in one time slot, we need only time slots to complete the transmission – data rate is doubled !

5. This forms the simple explanation of a probable MIMO transmission scheme with 2 transmit antennas and 2 receive antennas.

Having said this, some of you will wonder – the two transmitted symbols interfered with each other. Can we ever separate the two out? The rest of the post attempts to answer this question.

Page 17: Simulation Model

Figure: 2 Transmit 2 Receive (2×2) MIMO channel

Other Assumptions

1. The channel is flat fading – In simple terms, it means that the multipath channel has only one tap. So, the convolution operation reduces to a simple multiplication. For a more rigorous discussion on flat fading and frequency selective fading

2. The channel experience by each transmit antenna is independent from the channel experienced by other transmit antennas.

3. For the transmit antenna to receive antenna, each transmitted symbol gets multiplied

by a randomly varying complex number . As the channel under consideration is a Rayleigh

channel, the real and imaginary parts of are Gaussian distributed having mean and

variance .

4. The channel experienced between each transmit to the receive antenna is independent and randomly varying in time.

5. On the receive antenna, the noise has the Gaussian probability density function with

with and .

7. The channel is known at the receiver.

Zero forcing (ZF) equalizer for 2×2 MIMO channel

Page 18: Simulation Model

Let us now try to understand the math for extracting the two symbols which interfered with each other. In the first time slot, the received signal on the first receive antenna is,

.

The received signal on the second receive antenna is,

.

where

, are the received symbol on the first and second antenna respectively,

is the channel from transmit antenna to receive antenna,

is the channel from transmit antenna to receive antenna,

is the channel from transmit antenna to receive antenna,

is the channel from transmit antenna to receive antenna,

, are the transmitted symbols and

is the noise on receive antennas.

We assume that the receiver knows , , and . The receiver also knows and. The unknown s are and . Two equations and two unknowns. Can we solve it?

Answer is YES.

For convenience, the above equation can be represented in matrix notation as follows:

.

Equivalently,

To solve for , we know that we need to find a matrix which satisfies . The Zero Forcing (ZF) linear detector for meeting this constraint is given by,

.

Page 19: Simulation Model

This matrix is also known as the pseudo inverse for a general m x n matrix.

The term,

.

BER with ZF equalizer with 2×2 MIMO

Note that the off diagonal terms in the matrix are not zero (Recall: The off diagonal terms where zero in Alamouti 2×1 STBC case). Because the off diagonal terms are not zero, the zero forcing equalizer tries to null out the interfering terms when performing the equalization, i.e when solving for the interference from is tried to be nulled and vice versa. While doing so, there can be amplification of noise. Hence Zero Forcing equalizer is not the best possible equalizer to do the job. However, it is simple and reasonably easy to implement.

Further, it can be seen that, following zero forcing equalization, the channel for symbol transmitted from each spatial dimension (space is antenna) is a like a 1×1 Rayleigh fading channel Hence the BER for 2×2 MIMO channel in Rayleigh fading with Zero Forcing equalization is same as the BER derived for a 1×1 channel in Rayleigh fading.

For BPSK modulation in Rayleigh fading channel, the bit error rate is derived as,

.

Simulation Model

The Matlab/Octave script performs the following

(a) Generate random binary sequence of +1′s and -1′s.

(b) Group them into pair of two symbols and send two symbols in one time slot

(c) Multiply the symbols with the channel and then add white Gaussian noise.

(d) Equalize the received symbols

(e) Perform hard decision decoding and count the bit errors

(f) Repeat for multiple values of

and plot the simulation and theoretical results.

Page 20: Simulation Model

Figure: BER plot for 2×2 MIMO channel with ZF equalizer (BPSK modulation in Rayleigh channel)

Summary

1. As expected, the simulated results with a 2×2 MIMO system using BPSK modulation in Rayleigh channel is showing matching results as obtained in for a 1×1 system for BPSK modulation in Rayleigh channel.

2. As the Zero Forcing equalizer is not the best possible way to equalize the received symbol. The zero forcing equalizer helps us to achieve the data rate gain, but NOT take advantage of diversity gain (as we have two receive antennas).

3. We might not be able to achieve the two fold data rate improvement in all channel conditions. It can so happen that channels are correlated (the coefficients are almost the same). Hence we might not be able to solve for the two unknown transmitted symbols even if we have two received symbols.

4. It is claimed that there can be receiver structures which enables us to have both diversity gain and data rate gain. In future posts, the attempt will be to discuss receiver structures which hopefully enables us to find out approaches which will help us to keep the data rate gain, but still move from the 1×1 curve to 1×2 MRC curve.

The purpose of this simulator is to give some concrete idea of how SC-FDMAsystem works. It does lack many realistic and sophisticated features such as

Page 21: Simulation Model

channel coding, time-varying fading channel model, soft decision decoding,Directories /papr/ : PAPR simulators. Run paprSCFDMA.m for SC-FDMA andpaprOFDMA.m for OFDMA. /scfde/ : Link level simulator for single carrier with frequency domainequalization (SC/FDE) system. The simulator outputs symbol error rate(SER) for SC/FDE and OFDM. Run runSimSCFDE.m. /scfdma/ : Link level simulator for SC-FDMA system. The simulator outputsSER for localized mapping and distributed mapping. RunrunSimSCFDMA.m.