· Updated · · VORTARIAN · 12 min read

Live Spectrogram of the VORTARIAN SDR in MATLAB

Step by step from a fresh Linux host to a live spectrum and waterfall of all four receive channels of the VORTARIAN 4R2T-10G in MATLAB, with the vortarian MEX file and scripts that use no toolbox.

MATLAB figure with the live spectra and waterfalls of the VORTARIAN receive channels RX A, RX B and RX C around 2450 MHz over 34 seconds

The VORTARIAN 4R2T-10G streams four phase-coherent receive channels at 125 MS/s each over two 10 GbE links. In MATLAB, the vortarian MEX file receives both links, aligns them and returns the samples as an int16 matrix. This guide goes from a fresh Linux host to a spectrogram of all four channels and then to a live spectrum and waterfall display, like the one in GNU Radio, but built from contiguous blocks of samples. Every step was run on Ubuntu 26.04 LTS with MATLAB R2026b Update 1. The scripts use only core MATLAB functions, no toolbox. They are in the matlab/ directory of vortarian-sdr/host-tools.

What you need

ItemNotes
VORTARIAN 4R2T-10GFO1 and FO2 connected to the host
Dual-port 10 GbE network cardPCIe 3.0 x4 or PCIe 2.0 x8 for both links, see Tested 10 GbE Network Cards
Linux x86-64 hostthe MEX file uses recvmmsg and runs on Linux only
MATLABtested with R2026b; no toolbox
vortarian.mexa64the vortarian MEX file for MATLAB, as a binary
The example scriptsvortarian_spectrogram.m, vortarian_spectrogram_4ch.m, vortarian_waterfall.m

Step 1: Network

The FPGA sends the samples of each ADC as UDP datagrams of 8224 bytes: ADC 1 (RX A, RX B) on FO1 to port 10700, ADC 2 (RX C, RX D) on FO2 to port 10701. Each link carries about 8.1 Gb/s. The board is controlled over TCP port 5025 at 192.168.67.2.

Host portAddressCarries
connected to FO1192.168.67.10/24RX A and RX B (UDP 10700), board control at 192.168.67.2
connected to FO2192.168.68.10/24RX C and RX D (UDP 10701)

Both interfaces need jumbo frames (MTU 9000), the largest receive ring and no Ethernet pause frames: a pause frame from the host stops the stream of the board until the next debug on. The MEX file asks for a 256 MB receive buffer per socket, so the system limit has to be raised. optimize_eth_config.sh in the matlab/ directory sets all of it; it has to run again after a reboot:

sudo ./optimize_eth_config.sh <FO1 interface> <FO2 interface>

The commands it runs are listed in Spectrogram of the VORTARIAN SDR in GNU Octave, together with the PCIe requirements.

Step 2: The MEX file and the scripts

Get the scripts and put the MEX file next to them:

git clone https://github.com/vortarian-sdr/host-tools.git
cd host-tools/matlab
# vortarian.mexa64 from https://github.com/vortarian-sdr/vortarian-octave/releases

Start MATLAB, add the folder to the path and check that MATLAB loads the MEX file:

addpath('~/host-tools/matlab');
vortarian('version')
vortarian('config', 'host', '192.168.67.2');
vortarian('cmd', 'init');      % clocks, converters and synchronization, once after power-up

vortarian('version') prints the version of the MEX file. An error answer of the board raises the MATLAB error vortarian:board. The control daemon on the board serves one client at a time, so close any other connection to port 5025 first; otherwise the MEX file reports vortarian:busy.

CallFunction
vortarian('config', 'host', '192.168.67.2')Sets the defaults for the following calls
txt = vortarian('cmd', 'adc 1 nco 375000000')Sends a command, or a cell array of commands, and returns the answer
[iq, info] = vortarian('rx', N, 'on', 'debug on', 'off', 'debug off')Starts the streams, captures N contiguous samples per channel, stops the streams
[iq, info] = vortarian('rx', N)Captures N contiguous samples per channel from streams that are already running

iq has eight int16 columns: I and Q of RX A and RX B, then of RX C and RX D. Row k is the same sampling instant in all four channels. info reports how many datagrams were lost before the block was complete.

Step 3: A first spectrogram

vortarian_spectrogram_4ch.m captures 221 samples per channel, 16.8 ms, and draws the spectrograms of all four channels with 1024-point Hann FFTs and one colour scale in dBFS. It is the same script as in the GNU Octave article, which lists it and explains the scaling; it runs in MATLAB unchanged. Set f_nco to the IF you want in the centre and f_rf to the RF frequency that your front end converts to it, then run it:

vortarian_spectrogram_4ch

MATLAB figure with the spectrograms of RX A to RX D around 2450 MHz over 16.8 ms: on RX A and RX B a dotted line at 2449.0 MHz with short slanted lines above it, on RX C and RX D only weak lines

The spectrograms of the four channels from one capture, as MATLAB draws them, with antennas on RX A and RX B and none on RX C and RX D. The dotted line at 2449.0 MHz is a 2.4 GHz link that sends a burst every 507.9 µs, at −56.4 dBFS on RX A and −47.8 dBFS on RX B. After each burst a signal sweeps upwards; one 8.19 µs spectrum holds only part of a sweep, so the sweeps appear as short horizontal lines between 2449 and 2482 MHz. Without antennas, RX C and RX D still show the bursts at −73.7 and −76.5 dBFS. The median of all bins is −94.3 dBFS on RX A.

Step 4: A live spectrogram

A single capture shows 16.8 ms. To watch the band over minutes, vortarian_waterfall.m keeps both streams running and draws one new row per channel after each capture: the spectrum on top, the waterfall below it with the newest row at the top. Each row is computed from K = 256 contiguous spectra of 1024 samples, 262 144 samples or 2.1 ms, and shows their peak, so a burst anywhere in these 2.1 ms appears in the row.

function [W, f_if] = vortarian_waterfall(max_rows)
% vortarian_waterfall - live spectra and waterfalls of the four VORTARIAN receive channels
%
%   vortarian_waterfall              runs until the figure is closed
%   vortarian_waterfall(n)           stops after n rows
%   [W, f_if] = vortarian_waterfall  also returns the waterfalls (rows x nfft x 4,
%                                    dBFS, newest row first) and the IF axis [MHz]
%
% Each row of a waterfall is made of K consecutive spectra. With det = 'peak'
% it is their maximum: every burst in the K * nfft contiguous samples shows at
% its full level, and a short or swept signal fills all the bins it touches.
% With det = 'mean' it is their mean power, as in a spectrogram: levels are
% average power, short bursts are reduced by their duty cycle. Both streams
% are switched off when the function returns, also after Ctrl+C.

host  = '192.168.67.2';   % board address
f_nco = 375e6;            % NCO frequency of both ADCs, centre of the IF axis [Hz]
f_rf  = 2450e6;           % RF frequency at the IF centre [Hz]
fs    = 125e6;            % sample rate [S/s]
nfft  = 1024;             % FFT length, 122 kHz per bin
K     = 256;              % spectra per row: 256 * 1024 samples = 2.1 ms
det   = 'peak';           % row detector: 'peak' or 'mean' power of the K spectra
rows  = 400;              % rows of each waterfall
lim   = [-105 -40];       % colour scale and spectrum range [dBFS]

if nargin < 1, max_rows = Inf; end

vortarian('config', 'host', host);
vortarian('cmd', 'init');                       % needed after power-up
vortarian('cmd', {sprintf('adc 1 nco %.0f', f_nco), sprintf('adc 2 nco %.0f', f_nco)});
vortarian('cmd', 'debug on');                   % both streams run until 'debug off'
streams = onCleanup(@() vortarian('cmd', 'debug off'));

w    = 0.5 - 0.5 * cos(2*pi*(0:nfft-1)' / nfft);    % Hann window
f_if = (f_nco + (-nfft/2:nfft/2-1) * fs / nfft) / 1e6;
rf   = f_if([1 end]) + (f_rf - f_nco) / 1e6;
W    = lim(1) * ones(rows, nfft, 4);                % waterfalls, newest row on top

fig = figure('Color', 'w', 'Position', [1 1 1600 900], 'Name', 'VORTARIAN');
for c = 1:4
    x0 = 0.045 + (c - 1) * 0.228;
    ax = axes('Position', [x0 0.70 0.2 0.22], 'FontSize', 10, 'TickDir', 'out');
    hl(c) = line(f_if, lim(1) * ones(1, nfft));
    set(ax, 'XLim', f_if([1 end]), 'YLim', lim, 'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
    title(sprintf('RX %c', 'A' + c - 1), 'FontSize', 13);
    if c == 1, ylabel('dBFS'); end

    hw(c) = axes('Position', [x0 0.16 0.2 0.47]);
    hi(c) = imagesc(f_if, [0 1], W(:, :, c), lim);
    set(hw(c), 'FontSize', 10, 'TickDir', 'out');
    xlabel('IF [MHz]');
    if c == 1, ylabel('Time ago [s]'); end

    axes('Position', [x0 0.075 0.2 0.001], 'Color', 'none', 'YTick', [], ...     % RF axis
         'FontSize', 10, 'TickDir', 'out', 'XLim', rf, 'XTick', 20 * ceil(rf(1) / 20) : 20 : rf(2));
    xlabel('RF [MHz]');
end
cb = colorbar(hw(4));  ylabel(cb, 'dBFS');
set(hw(4), 'Position', [x0 0.16 0.2 0.47]);
set(cb, 'Position', [0.955 0.16 0.008 0.47], 'FontSize', 10);
set(findall(fig, 'Type', 'axes'), 'Toolbar', []);   % no axes toolbars
annotation('textbox', [0 0.95 1 0.04], 'EdgeColor', 'none', 'HorizontalAlignment', 'center', ...
           'FontSize', 14, 'FontWeight', 'bold', 'String', ...
           sprintf('RF %.1f MHz at IF %.1f MHz, each row the %s of %d spectra of %d samples', ...
                   f_rf / 1e6, f_nco / 1e6, det, K, nfft));

n = 0;  dt = 0.1;  t = tic;
while ishghandle(fig) && n < max_rows
    try
        iq = vortarian('rx', K * nfft, 'margin', 1024);  % the next K * nfft contiguous samples
    catch err
        warning('vortarian_waterfall:rx', '%s', err.message);  % skip this row
        drawnow;
        continue;
    end
    x  = complex(double(iq(:, 1:2:end)), double(iq(:, 2:2:end))) / 32768;
    for c = 1:4
        S = abs(fft(reshape(x(:, c), nfft, K) .* w)) / sum(w);
        if strcmp(det, 'mean')
            S = sqrt(mean(S .^ 2, 2));                  % mean power of the K spectra
        else
            S = max(S, [], 2);                          % peak of the K spectra
        end
        P = 20 * log10(fftshift(S) + 1e-12);
        W(:, :, c) = [P.'; W(1:end-1, :, c)];
        set(hl(c), 'YData', P);
        set(hi(c), 'CData', W(:, :, c), 'YData', [0 (rows - 1) * dt]);
        set(hw(c), 'YLim', [0 (rows - 1) * dt]);
    end
    drawnow limitrate;
    n  = n + 1;
    dt = 0.9 * dt + 0.1 * toc(t);  t = tic;     % mean time per row
end
end

Run it and close the figure to stop:

vortarian_waterfall

The function switches both streams on once with debug on and leaves them running. Each vortarian('rx', N) call then opens the two sockets, takes the next N contiguous samples that arrive on both links and closes the sockets again; the datagrams between two calls are not received. 'margin', 1024 lets the MEX file keep up to 1024 datagrams per link, 8.4 ms, while it waits for the other link: when the sockets open, one link can start up to about 1 ms later than the other. A call for 2.1 ms of samples took 10 to 15 ms on our test PC. The onCleanup object sends debug off when the function returns, also when it is stopped with Ctrl+C, so the board does not keep both 10 GbE links full.

The time axis is the mean time per row, measured while the loop runs. With MATLAB on a display without graphics acceleration, as in the recording below, one row took 85 ms: about 15 ms for the capture, 31 ms for the conversion and the FFTs of the four channels, and the rest for drawing. The 400 rows then cover 34 s, and each row shows 2.1 ms of every 85 ms, 2.5 % of the signal. The spectrum on top is the newest row.

MATLAB figure with four spectra on top and four waterfalls over 34 s below: RX A and RX B show a band from 2449 to 2482 MHz in every row, a line at 2449 MHz and short bursts at 2402, 2426 and 2480 MHz; RX C and RX D only weak copies of the strongest bursts

The live display after 400 rows, 34 s, with antennas on RX A and RX B and none on RX C and RX D. The band from 2448.8 to 2482.3 MHz, at −67 dBFS in the median of the rows on RX A, is the sweeps of the link from Step 3: with a burst every 507.9 µs, each 2.1 ms row holds four of them, and their peak fills the band. The peak of the K spectra of the capture in Step 3 gives the same band at the same level. The line at 2449.0 MHz reads −56 dBFS on RX A and −48 dBFS on RX B. The short bursts on 2402, 2426 and 2480 MHz fall on the three Bluetooth Low Energy advertising channels; the strongest reaches −22.5 dBFS on 2402.0 MHz on RX B. Because each pixel is the largest of 256 values, the noise floor sits at −83 dBFS on RX A and RX B and at −85 dBFS on RX C and RX D, about 11 dB above the median of single spectra.

The video shows 25 s of the same run, recorded from the screen at 10 frames per second.

Compared with the GNU Radio waterfall

The QT GUI waterfall sink of GNU Radio computes one 1024-point FFT per update period and discards the samples in between: with an update period of 0.1 s, a row shows 8.19 µs of every 100 ms, 0.008 % of the signal, and a short burst appears only when it happens to fall into that window. A row of vortarian_waterfall covers 256 times more contiguous samples and, at 85 ms per row, about 300 times more of the signal. The price is the noise floor: the peak of 256 spectra lies about 11 dB above the floor of a single spectrum, so a weak continuous signal stands out less.

Changing the display

ToChange
Tune to another bandf_nco (250 to 500 MHz in the standard build) and f_rf
Average instead of peakdet = 'mean'
More or less time per rowK: 64 for 0.5 ms, 1024 for 8.4 ms of samples per row
A longer historyrows
A finer frequency gridnfft, for example 4096 (30.5 kHz per bin) with K = 64
Fix the colour scalelim

With the mean of the power instead of the peak, a row reads the average power in each bin over 2.1 ms: continuous signals keep their level and the noise floor returns to that of a single spectrum, but a burst that fills only part of the row is diluted by the ratio of its length to 2.1 ms.

When it does not work

MessageCause
vortarian:busyanother client holds the control port: the board console, a second MATLAB session, GNU Radio
vortarian:board with “Board initialization has not been run”init has not run since the board was powered up
vortarian:nodata or a timeoutno datagrams arrive: check the links, the host addresses and the firewall for UDP 10700 and 10701
no ... contiguous packets present in all streamsdatagrams are lost on the host: check MTU, ring size, pause frames and net.core.rmem_max (Step 1), or raise 'margin'
The display updates slowlyMATLAB draws without graphics acceleration: fewer rows, a smaller figure, or a larger K to cover more time per row

The capture and the dBFS scaling are described in more detail in Spectrogram of the VORTARIAN SDR in GNU Octave, the datagram header in The VORTARIAN I/Q Datagram Header, and the board connectors in VORTARIAN 4R2T-10G Board Ports. For questions about the platform or a custom configuration, contact us.

Written by

· Lead RF/FPGA engineer at JSE

Jiří has designed RF and signal-processing hardware and FPGA firmware since 2003, starting with receivers and signal-processing boards for radar systems. He holds a master's degree in radio engineering from the Czech Technical University in Prague.

LinkedInGitHubAbout JSE

Share:
Back to Blog