This example shows how to measure and calibrate for transmitter/receiver frequency offset at the receiver using Simulink® and Communications System Toolbox™. You can either use captured signals or receive signals in real time using the Communications System Toolbox Support Package for RTL-SDR Radio. The receiver monitors the received signal, calculates and display the transmitter/receiver frequency offset.
To run this example using captured signals, you need the following software:
To receive signals in real time, you also need the following hardware:
and the following software
For a full list of Communications System Toolbox supported SDR platforms, refer to Supported Hardware section of Software Defined Radio (SDR) discovery page.
For an introduction on the frequency offset calibration for receivers, refer to the Frequency Offset Calibration for Receivers Using MATLAB example.
To run the example using captured signals, select the
Frequency Offset Captured Signal block as the source using the
Signal Source Selector block. Then click the run button. The model processes signals that were captured with an RTL-SDR radio at a center frequency of 560309440 Hz. This value corresponds to the pilot tone of channel 29 of digital TV signals in the USA.
To run the example using the RTL-SDR radio as the source, select the
RTL-SDR Receiver block as the source using the
Signal Source Selector block. Double-click the
Expected Center Frequency block and set to the expected tone frequency. Begin transmitting with your known signal source. If you are in the USA, you can set the expected center frequency to the pilot tone of a near by digital TV transmitter. For a list of channel number and frequency values, see North American television frequencies. Then click the run button.
If you use the RTL-SDR radio as the source, to compensate for a transmitter/receiver frequency offset, specify the displayed PPM correction value as the Frequency correction (ppm) parameter of the RTL-SDR Receiver block. Be sure to use the sign of the offset in your specification. The spectrum displayed by the Spectrum Analyzer block should then have its maximum at 0 Hz.
The following figure shows the receiver model:
The following figure shows the detailed structure of the Receiver subsystem:
The Find Peak Frequency block - uses an FFT to find the frequency with the maximum power in the received signal.
The Spectrum Analyzer block - computes and displays the power spectral density of the received signal.
The Find Peak Frequency subsystem finds the frequency with the maximum power in the received signal, which equals the frequency offset. The following diagram shows the subsystem. In this subsystem, the Periodogram block returns the PSD estimate of the received signal. The Probe block finds the frame size and the frame sample time. With this information, this subsystem finds the index of the maximum amplitude across the frequency band and converts the index to the frequency value according to
Foffset = IndexofMaxAmplitude * FrameSize / (FFTLength * FrameSampleTime)
The MATLAB function findpeakfreq.m performs this conversion.
The following figure shows the output of the Spectrum Analyzer on a frequency range of -200 kHz to 200 kHz. In the case shown below, the frequency with the maximum power of the received signal is about -35 kHz.