# Simulation of OFDM system in Matlab – BER Vs Eb/N0 for OFDM in AWGN channel

This post is a part of the ebook : Simulation of digital communication systems using Matlab – available in both PDF and EPUB format.

To simulate an OFDM system, following design parameters are essential. Lets consider the OFDM system parameters as defined in IEEE 802.11^{[1]} specifications

**Given parameters in the spec:**

N=64; **%FFT size or total number of subcarriers (used + unused) 64**

Nsd = 48; **%Number of data subcarriers 48**

Nsp = 4 ; ** %Number of pilot subcarriers 4**

ofdmBW = 20 * 10^6 ; **% OFDM bandwidth**

**Derived Parameters:**

deltaF = ofdmBW/N; ** % Bandwidth for each subcarrier – include all used and unused subcarries**

Tfft = 1/deltaF; **% IFFT or FFT period = 3.2us **

Tgi = Tfft/4; ** % Guard interval duration – duration of cyclic prefix – 1/4th portion of OFDM **symbols

Tsignal = Tgi+Tfft; ** % Total duration of BPSK-OFDM symbol = Guard time + FFT period**

Ncp = N*Tgi/Tfft; ** %Number of symbols allocated to cyclic prefix**

Nst = Nsd + Nsp; ** % Number of total used subcarriers**

nBitsPerSym=Nst; **%For BPSK the number of Bits per Symbol is same as number of subcarriers**

We will use the following model for simulating the OFDM system.

The channel in this case is modeled as a simple AWGN channel. Since the channel is considered to be an AWGN channel, there is no need for the frequency domain equalizer in the OFDM receiver ( Frequency domain equalizer will be helpful only if the channel introduces multipath fading). Since our channel is an AWGN channel, the frequency domain equalizer block in the above diagram can be removed.

### Calculating Es/N0 or Eb/N0 for OFDM system:

In order to do a Monte Carlo simulation of an OFDM system, required amount of channel noise has to be generated that is representative of required Eb/N0. In Matlab it is easier to generate a Gaussian noise with zero mean and unit variance. The generated zero-mean-unit-variance noise has to be scaled accordingly to represent the required Eb/N0 or Es/N0. If we have Es/N0, the required noise can be generated from zero-mean-unit-variance-noise by,

Since the OFDM system transmits and received the data in symbols, it is appropriate/easier to generate required noise based on Es/N0 instead of Eb/N0 (as given above). But we are interested in plotting BER against Eb/N0. Ok!!! Then… how do we convert given Eb/N0 to Es/N0 for an OFDM system ?

Normally for a simple BPSK system, bit energy and symbol energy are same. So Eb/N0 and Es/N0 are same for a BPSK system. But for a OFDM BPSK system, they are not the same. This is because, each OFDM symbol contains additional overhead in both time domain and frequency domain. In the time domain, the cyclic prefix is an additional overhead added to each OFDM symbol that is being transmitted. In the frequency domain, not all the subcarriers are utilized for transmitted the actual data bits, rather a few subcarriers are unused and are reserved as guard bands.

### Effect of Cyclic Prefix on Es/N0:

The following diagram illustrates the concept of cyclic prefix. Each OFDM symbol contains both useful data and overhead (in the form of cyclic prefix). The bit energy represents the energy contained in the useful bits. In this case, the bit energy is spread over N bits (where N is the FFT size). On top of the useful data, additional Ncp bits are added as cyclic prefix, which forms the overhead. So if the entire OFDM symbol is considered, the symbol energy is spread across N+Ncp bits.

This relationship is given as

which translates to,

### Effect of unused subcarriers on Es/N0:

As mentioned earlier, not all the subcarriers are used for transmission. Out of the total N subcarriers, only Nst carriers are used for OFDM symbols transmission (this includes both data and pilot subcarriers). Again, in the frequency domain, the useful bit energy is spread across Nst subcarriers, whereas the symbol energy is spread across N subcarriers. This gives us another relationship between Es and Eb as given below

which translates to,

From (1) and (2), the overall effect of both cyclic prefix and unused subcarriers on Es/N0 is given by

which, when converted to dB yields the following relationship.

Since Ncp cylic prefix are added to the OFDM symbol, the output signal from the parallel to serial converter has to be boosted to compensate for the wastage of energy associated with the addition of cyclic prefix. To properly generate the required SNR in Matlab, the signal term at the output of the parallel to serial converter has to be scaled as follows

The received signal is represented as (for the given Eb/N0)

### Arrangement of subcarriers:

The IEEE 802.11 specification, specifies how to arrange the given subcarriers. The 52 used subcarriers (data + pilot) are assigned numbers from -26,-25,…-2,,-1 and 1,2,…,25,26. The following figure illustrates the scheme of assigning these subcarriers to the IFFT inputs.

### Simulation:

Check this book for full Matlab code.

Simulation of Digital Communication Systems Using Matlab – by Mathuranathan Viswanathan

### Simulated Result:

From the simulated result, it can be ascertained that the OFDM- BPSK modulation has no advantage over a normal BPSK system in AWGN. OFDM proves to be effective in multipath environments.

### References

### Books on OFDM

### See Also:

(1) Introduction to OFDM – Orthogonal Frequency Division Multiplexing

(2) An OFDM Communication System – Implementation Details

(3) Role of Cyclic Prefix in OFDM

Pingback: An OFDM Communication System | GaussianWaves()

Pingback: Introduction to OFDM – orthogonal Frequency division multiplexing – part 4 – Cyclic Prefix | GaussianWaves()

Pingback: Introduction to OFDM – orthogonal Frequency division multiplexing | GaussianWaves()

Pingback: MIMO – Diversity and Spatial Multiplexing | GaussianWaves()

Pingback: How should I implement OFDM in MATLAB? - Quora()