Tag Archives: BPSK

Modeling Phase and Frequency Synchronization Error

Carrier phase or frequency synchronization is a common problem in wireless communication systems. These two problems are interrelated as instantaneous frequency is just the rate of change of phase. The problem of carrier frequency offset might appear due to one of two reasons. Either the oscillators at the transmitter and receiver are not aligned in the frequency domain or there is a Doppler shift introduced by the channel (remember that a moving object in the wireless environment introduces a Doppler shift). In the case of the former the frequency misalignment is given in parts per million (ppm). A typical value for commercially available oscillators is ±20 ppm. Assuming that there is maximum frequency error at both the transmitter and receiver the error increases to ±40 ppm. At 1GHz this translates to 40*1,000,000,000/1,000,000 = 40kHz.

MATLAB code for calculating Bit Error Rate (BER) in presence of phase and frequency error is given below.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BSPK MODULATION WITH CARRIER
%    PHASE/FREQUENCY ERROR
%       www.raymaps.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
close all

l=5e3;              % Number of BPSK symbols
N=40;               % Samples per symbol
fc=1e9;             % Carrier frequency
fs=10*fc;           % Sampling frequency
ts=1/fs;            % Sampling interval
t=0:ts:ts*(N*l-1);  % Total time
Eb=N;               % Energy per bit
EbNodB=10;          % Energy per bit to noise PSD in dB
dp=0;               % Phase offset
df=10e3;            % Frequency offset

% CARRIER GENERATION
tx_carrier=(sqrt(2))*cos(2*pi*fc*t);
rx_carrier=(sqrt(2))*cos(2*pi*(fc+df)*t+dp);

% SIGNAL GENERATION
tx_symbol=2*(round(rand(1,l))-0.5);
oversampled_sym_matrix=ones(N,1)*tx_symbol;
oversampled_sym_vector=reshape(oversampled_sym_matrix,1,N*l);
tx_signal=oversampled_sym_vector.*tx_carrier;

% NOISE ADDITION
EbNo=10^(EbNodB/10);
calibrated_noise=sqrt(Eb/(2*EbNo))*randn(1,N*l);
rx_signal=tx_signal+calibrated_noise;

% SIGNAL RECOVERY
down_converted_signal=rx_signal.*rx_carrier;
filtered_signal=ones(1,N)*reshape(down_converted_signal,N,l);
rx_symbol=sign(filtered_signal);

% BIT ERROR RATE CALCULATION
ber=(l-sum(tx_symbol==rx_symbol))/l

Note:

  1. We have used passband simulation unlike our previous posts since the above concepts are easier to explain this way. But the down side is that simulation takes longer, since we sample at ten times the carrier frequency to get accurate results.
  2. Please note that a constant frequency error increases the phase error and the results are quite adverse even for a small frequency shift. The cumulative phase shift depends upon how long a symbol sequence we are simulating (since phase is just the integral of the frequency) .
  3. A drift in the local oscillator can be on either side, higher or lower, or even cyclic. So, it is possible that cumulative effect is very small.
  4. In practical systems phase of the carrier is estimated at the receiver by a Phase Locked Loop (PLL). This is something we will discuss in a future post.