MATLAB Examples

SER Simulation for OFDM Link

This example shows how to perform a symbol error rate (SER) simulation of an over-the-air OFDM communication link.

A basic communications link using OFDM modulation with QPSK symbols is simulated. There is a single transmit and a single receive antenna.

Create QPSK modulator and demodulator objects.

qpskMod = comm.QPSKModulator;
qpskDemod = comm.QPSKDemodulator;

Create a default OFDM modulator and demodulator pair.

ofdmMod = comm.OFDMModulator;
ofdmDemod = comm.OFDMDemodulator;

Use the info function to determine the required input dimensions for the OFDM modulator.

modDim = info(ofdmMod)
modDim = 

  struct with fields:

    DataInputSize: [53 1]
       OutputSize: [80 1]

Set the number of frames. Determine the number of OFDM symbols per frame from the modDim.DataInputSize array.

nFrames = 100;
nSymbolsPerFrame = modDim.DataInputSize(1);

Create an error rate counter with a reset input port. Initialize the symbol error rate vector, SER.

errRate = comm.ErrorRate('ResetInputPort',true);
SER = zeros(nFrames,1);

Run the simulation over 100 OFDM frames (5300 symbols). During loop execution, generate a random data vector with length equal to the required number of symbols per frame, Apply QPSK modulation and then apply OFDM modulation. Pass the OFDM modulated data through the AWGN channel and then apply OFDM demodulation. Demodulate the resultant QPSK data and compare it with the original data to determine the symbol error rate.

for k = 1:nFrames
    % Generate random data for each OFDM frame
    data = randi([0 3],nSymbolsPerFrame,1);

    % Apply QPSK modulation
    txQPSK = qpskMod(data);

    % Apply OFDM modulation
    txSig = ofdmMod(txQPSK);

    % Pass OFDM signal through AWGN channel
    rxSig = awgn(txSig,23);

    % Demodulate OFDM data
    rxQPSK = ofdmDemod(rxSig);

    % Demodulate QPSK data
    rxData = qpskDemod(rxQPSK);

    % Compute BER
    errors = errRate(data,rxData,1);
    SER(k) = errors(1);

Display the symbol error data for the first ten frames.

ans =