Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

Frequency offset estimation for OFDM in MATLAB

This page of MATLAB source code covers frequency offset estimation and correction used in a OFDM based system receiver. The concept is employed in wireless technologies such as WLAN, WiMAX, LDACS etc.

Frequency Offset estimation

Frequency synchronization module enables the receiver to overcome frequency offsets induced due to transmitter and receiver clock variations, drifts etc. On this page we will see frequency offset estimation using reference data i.e. preamble.

•  Extract the first symbol of preamble from the received packet. (excluding CP)
•  Multiply first 128 samples with complex conjugate of next 128 samples of the first symbol preamble.
•  Estimate angle of above 128 multiplications.
•  Take average of the angle vector
•  Divide average value by 2*pi.
•  Multiply result with 4 as frequency bins are spaced at every 4th place.
•  This will give frequency offset.
•  Note: Frequency offset estimation using symbol2 can also be done in the similar manner explained above. Multiply result with 2 as frequency bins are spaced at every second place in the second symbol preamble.

close all;
clear all;
load file_wimaxtxpkt;
load file_wimax_preamble;
%%%%Introducing frequency offset%%%%%%%%%%%%
CFO = 40e3; % Hz Here 40KHz frequency offset
CFO = (CFO)/20e6;
rx_data_fo = impairments(Tx_Packet,CFO);
%Frequency offset estimation using first symbol preamble in time domain
sh_dat = rx_data_fo((CP+1):256+CP);
for m=0:128
theta(m+1) = angle(sh_dat(65+m:128+m)*sh_dat(1+m:64+m)')/(2*pi);
theta = mean(theta);
f_off1 = (theta*4)*20e6/256
%Frequency offset estimation using second symbol preamble in time domain
lo_dat = rx_data_fo((2*CP+256+1):256+2*CP+256);
theta = angle(lo_dat(129:256)*lo_dat(1:128)')/(2*pi);
f_off2 = (theta*2)*20e6/256
f_off=(f_off1+f_off2)/2 % average of both above symbol based estimation.
%%%%%%%%%Frequency offset correction%%%%%%%%
rx_data_corrected = rx_data_fo.*exp(-i*2*pi*(f_off/20e6)*(0:length(rx_data_fo)-1));

Frequency offset correction

For Frequency offset correction utilize the frequency offset estimated above and multiply the received symbols using exponential function as mentioned below.
y(n)= y'(n).exp(-i2π α n/N )
where n is sample index and N is no. of samples in a symbol, y(n) and y'(n) are the received samples without and with frequency offset and α is the frequency offset estimated (f_off or f_off1 or f_off2) using above algorithms.


Download MAT and other supporting files.

Useful Links to MATLAB codes

Refer following as well as links mentioned on left side panel for useful MATLAB codes.
OFDM Preamble generation  Time off estimation corr  Freq off estimation corr  channel estimation  11a WLAN channel  PN sequence generation  OFDMA Tx Rx  AES DES  carrier aggregation  CCDF  FIR Filter  IIR Filter  Low Pass FIR  Viterbi decoder  CRC8 CRC32 

RF and Wireless tutorials

WLAN  802.11ac  802.11ad  wimax  Zigbee  z-wave  GSM  LTE  UMTS  Bluetooth  UWB  IoT  satellite  Antenna  RADAR 

Share this page

Translate this page