# Connexions

You are here: Home » Content » OFDM Symbol Decoder (Receiver) (MATLAB)

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### In these lenses

• Lens for Engineering

This module is included inLens: Lens for Engineering
By: Sidney Burrus

Click the "Lens for Engineering" link to see all content selected in this lens.

### Recently Viewed

This feature requires Javascript to be enabled.

# OFDM Symbol Decoder (Receiver) (MATLAB)

Module by: Bryan Paul, Aditya Jain. E-mail the authors

Summary: This file brings together all of the previous files into one MATLAB interface. With one command, and the right parameters, one can successfully receive one training symbol and one data symbol. NOTE: The MATLAB library was used in the initial version of the design but has since been replaced by an updated LabVIEW module. Please see the LabVIEW portion of the receiver for the most current version.


%% Demodulate Baseband OFDM Signal (RECEIVER)
%  ------------------------------------------------------------------------
%  Description: This is the receiver module in its entirity. It combines
%               all of the sub-processes and parameters to ultimately take
%               a sequency of training symbol and valid OFDM symbol, and
%               output the modulated bits.
%
%  Inputs: word_to_symbol_map - The complex symbols indexed by the binary
%                               word they represent.
%          num_subcarriers - The number of subcarriers in the symbol
%          size_of_fft - Size of FFT used for correct indexing/timing
%          train_pn - Pseudo-noise used in transmitted training symbol (a
%                     priori knowledge)
%  Outputs: bits - Demodulated bits

function bits = ofdm_dem(word_to_symbol_map, num_subcarriers, size_of_fft, train_pn)
%%
% Calculated the expected training symbol from the given pseudo-noise for
train_expected = zeros(1,size_of_fft);
train_expected(3) = train_pn(1);
train_expected(size_of_fft-1) = train_pn(1+size(train_pn,2)/2);
train_expected = ifft(4*train_expected);
z = get_input(); % Parse input data
z = z'; % Convert from column vector to row vector to accomidate sub-processes
% Invoke timing algorithm to retrieve sample that training symbol starts on
[index value] = tsync(z,size_of_fft);
train = z(index:index+size_of_fft-1); % Cut out training symbol
phi = fsync(train, train_expected); % Estimate phase offset
% Cut out OFDM data symbol and correct for phase offset
z = z(index+size_of_fft:index+2*size_of_fft-1).*exp(j*phi);

% Separate the data symbol into two channels and take FFT for analysis
% below
re = real(z);
im = imag(z);
Z = fft(z);

symbols = fft2sym(re,im,num_subcarriers); % Take FFT and retrieve symbols
words = sym2w(symbols,word_to_symbol_map); % Find closest match and map words to symbols
bits = fliplr(w2b(words)); % Decompress words into a series of bits for recovery.

% Output the resulting data for debugging and analysis
subplot(5,2,1); plot(real(train)); title('Re[Training Symbol]');
subplot(5,2,2); plot(imag(train)); title('Im[Training Symbol]');
subplot(5,2,3); plot(re); title('Re[OFDM Data Symbol]');
subplot(5,2,4); plot(im); title('Im[OFDM Data Symbol]');
subplot(5,2,[5 6]); plot(abs(Z)); title('Mag[OFDM Data Symbol Spectrum]');
subplot(5,2,[7 8]); stem(real(Z)); title('Re[OFDM Data Symbol Spectrum]');
subplot(5,2,[9 10]); stem(imag(Z)); title('Im[OFDM Data Symbol Spectrum]');

end


## Content actions

### Give feedback:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks