### Compensate for Frequency Offset Using Coarse and Fine Compensation in MATLAB

www.spiroprojects.com

Correct for a phase and frequency offset in a noisy QAM signal using a carrier synchronizer. Then correct for the offsets using both a carrier synchronizer and a coarse frequency compensator.
Set the example parameters.
fs = 10000;           % Symbol rate (Hz)
sps = 4;              % Samples per symbol
M = 16;               % Modulation order
k = log2(M);          % Bits per symbol

Create a QAM modulator and an AWGN channel.
mod = comm.RectangularQAMModulator(M);
chan =  comm.AWGNChannel('EbNo',15,'BitsPerSymbol',k,'SamplesPerSymbol',sps);

Create a constellation diagram object to visualize the effects of the offset compensation techniques.
cd = comm.ConstellationDiagram(...
'ReferenceConstellation',constellation(mod), ...
'XLimits',[-5 5],'YLimits',[-5 5]);

Introduce a frequency offset of 400 Hz and a phase offset of 30 degrees.
foffset = comm.PhaseFrequencyOffeset(...
'FrequencyOffset',400,...
'PhaseOffset', 30,...
'SampleRate',fs);

Generate random data symbols and apply 16-QAM modulation.
data = fandi([0 M-1],10000,1) ;
txSig = step(mod,data);
Apply the phase and frequency offset and then pass the signal through the AWGN channel,chan.
rxSig = step(chan,step(fOffset,txSig));

Apply fine frequency correction to the signal by using the carrier synchronizer.
csync = comm.CarrierSynchronizer('DampingFactor',0.7, ...
'NormalizedLoopBandwidth', 0.005, ...
'SamplesPerSymbol', sps, ...
'Modulation', 'QAM');
rxData = step(csync,rxSig);
Display the constellation diagram of the last 1000 symbols.
step(cd,rxData(9001:10000))

Even with time to converge, the spiral nature of the plot shows that the carrier synchronizer has not yet compensated for the large frequency offset. The 400 Hz offset is 1% of the sample rate.
Repeat the process with a coarse frequency compensator inserted before the carrier synchronizer.
Create a coarse frequency compensator to reduce the frequency offset to a manageable level.
cfc = comm.CoarseFrequencyCompensator('Modulation','QAM','SampleRate',fs);

Pass the received signal to the coarse frequency compensator and then to the carrier synchronizer.
syncCoarse = step(cfc,rxSig);
rxData = step(csync,syncCoarse);

Plot the constellation diagram of the signal after coarse and fine frequency compensation.
release(cd)
step(cd,rxData(9001:10000))

The received data now aligns with the reference constellation.

Previous
Next Post »