Matlab and GNU Radio are very commonly used platforms for post-processing of the received data. As such, Nutaq products support both MATLAB and GNU Radio. The purpose of this brief application note is to compare and contrast the design flow with Matlab as well as GNU Radio and to demonstrate how the signal processing tasks can be distributed between the host machine and the FPGA. To this end, we will utilize Nutaq’s GSM Channelizer Demo which was originally designed to work with GNU Radio, and see how we can achieve similar functionalities in MATLAB.

GSM Channelizer using GNU Radio and FPGA-based Processing

FPGA Design for the GSM Channelizer

Fig.1 – FPGA Design for the GSM Channelizer

The GSM channelizer design is based on the WR8G RF front-end and PicoDigitizer250. With a centre frequency of 859.2 MHz and a bandwidth of a 100 MHz, the design scans the spectrum for activity in various GSM channels. In order to visualize the spectral content of each GSM channel, we use a polyphase FFT with 512-point FFT. Each FFT bin is associated with a 200 kHz GSM channel. This requires a sampling frequency of 102.4 MHz (512 * 200 kHz) on the A/D and FPGA logic. The original design performed the FFT, filtering and averaging operations on the FPGA and the processed data was then sent to GNU Radio for display. The FPGA design is shown in Fig. 1, where after the polyphase channelization, the processed signal propagates in two directions. The first path goes through magnitude and average calculations, which are then used to display the waterfall design shown on the left side in Fig. 2, where the yellow lines indicate that there is an on-going activity in the specific GSM channel. On the other hand, the second path goes directly to the RTDex blocks, from where the signal values are retrieved in GNU Radio to display the time-domain and frequency-domain signals in real-time, as shown on the right side of Fig. 2.

Waterfall and graphs showing the output of the GSM channelizer.

Fig. 2 – Waterfall and graphs showing the output of the GSM channelizer.


Fig. 3 below shows the GNU Radio design. Here again, we see two different data paths. The path on the top, which terminates in the Nutaq Waterfall, corresponds to the first path inside the FPGA, where the signal undergoes the averaging operation. The second path corresponds to the second path on the FPGA design, which has already been explained earlier. The results displayed in Fig. 2 are updated in real-time as the signal processed inside the FPGA is streamed directly to the host machine. To this end, the RTDex Source blocks shown on the left in Fig. 3 regularly check the Ethernet interface to see if there is new data available to be transmitted to the host machine. At this stage, it is imperative to mention that the 512-point FFT operation is performed inside the Polyphase FFT block, where the Xilinx FIR Compiler block is used along with the FFT block, as shown in Fig. 4.


Fig.3 - GNURadio design for the GSM Channelizer

Fig.3 – GNURadio design for the GSM Channelizer

Fig.4 - Polyphase Channelizer

Fig.4 – Polyphase Channelizer

Wideband Digitizer in MATLAB

In order to analyze the spectrum, similar to the way it has been done in the GSM Channelizer design, one can also utilize MATLAB along with the Nutaq product. Moreover, it is also up to the designers to decide whether they want to carry out the entire signal processing within the FPGA, as done above, or within MATLAB, as we explain in the discussion that follows. One way to process data efficiently in MATLAB is to save data in the onboard DDR3-SODIMM RAM and then transfer it to MATLAB for further processing. Each Nutaq product comes with a 4 GB DDR-3 SODIMM RAM, which can be used to store data at very high speeds (Maximum throughput of up to 5.7 GBps). Then, the saved data can be imported into the host machine for further processing in MATLAB.

For the discussion henceforth, we use the WR8G RF front-end along with PicoDigitier250, i.e., the hardware setup is the same as it was for the GSM Channelizer. The sampling rate was set to 250 Msps. Instead of performing signal processing within the FPGA, we use MATLAB for performing the FFT operation and for plotting the results. The signal received by the RF front-end is directly saved in the onboard RAM, i.e., the outputs of the two green ADC blocks, shown on the left in Fig. 1 are sent directly to the DDR3 RAM. Then, Nutaq’s C-APIs, which come as part of the Nutaq software, are used to import the data onto the host machine, where it is saved as a .bin file. The contents of the .bin file are then loaded into MATLAB, using the ‘fopen’ and ‘fread’ MATLAB functions.

Once the data has been imported into MATLAB, the next step is to organize it such that the I and Q samples are aligned with each other. To this end, for this example, we scanned the spectrum and imported 65536 bytes of data to the host machine. To calculate the right frame size, i.e., number of samples per channel, we note that the setup consists of two channels, I and Q. Furthermore, each sample consists of 16-bits (FPGA configuration), and 8 bits form a byte, therefore, the total number of samples per channel can be found by dividing the total number of bytes by 4, which in this case, comes to 16384. Using this value, the ‘fpgaacqgetframes’ function, provided by Nutaq as part of its BAS, can be used to split the data into I and Q samples. The fpgaacqgetframes fuction works in a similar manner as the Deinterleave block used in GNURadio, as shown in Fig. 3. Once the I and Q samples have been separated, the final step is to combine them to form complex samples, using ‘complex’ function provided by MATLAB. At this stage, we are ready to proceed with performing the FFT. As a first step, we plot the time domain signal, using the below commands:

  • Fs = 250e6; %sampling rate
  • Ts = 1/Fs; %sampling time interval
  • X_data = source_data; %After the conversion to complex
  • n = length(X_data); %number of samples
  • t = 0:Ts:(n * Ts)-Ts; %sampling period
  • %plot the original curve in the time domain
  • plot(t,X_data);

Execution of the above code results in the display of time domain signals, as shown below:

Fig.5 -Time-domain signal

Fig.5 -Time-domain signal


Following this, the FFT operation can be performed in two ways. The first approach is to use the code shown below:

  • N=2*length(source_data); %get the number of points
  • k=0:N-1;     %create a vector from 0 to N-1
  • T=N/Fs;      %get the frequency interval
  • freq=k/T;    %create the frequency range
  • X=fft(x,N);
  • psdx = (1/(Fs*N))*abs(source_data).^2; %power spectral density
  • plot(freq, 10*log10(fftshift(psdx)))


Execution of the above code results in the display of the frequency domain signals, as shown below:

Fig. 6 - Frequency-Domain signal.

Fig. 6 – Frequency-Domain signal.

Lastly, one can also use the dsp.SpectrumAnalyzer block, provide by MATLAB, to analyze the spectral contents of the received signals. To this end, the following two commands can be used , which result in the display shown in Fig. 7.

  • hsa = dsp.SpectrumAnalyzer(‘SampleRate’, 250e6,. . .
  • ‘FrequencyOffset’, 2.5e9);
  • step(has, source_data)

The advantage of using this second approach is that, just like the GNU Radio design of the GSM Channelizer, one can also manually select the specific channel of interest in MATLAB, using the ‘Channel Measurements’ option that comes with the Spectrum Analyzer tool. While the approach of saving the data as a file and then in processing it in MATLAB is useful, the main limitation with this approach is that, unlike GNU Radio, the analysis in MATLAB is not real-time.

Fig.7 - Output of dsp.SpectrumAnalyzer

Fig.7 – Output of dsp.SpectrumAnalyzer

05-04-2016, Auon Akhtar, PhD, Field Application Engineer