Evaluate Host Capture Performance
R2026bThis example shows how to check your host performance capability for capturing data using the baseband receiver.
Introduction
When you capture data using a baseband application object, the capture function supports two operating modes. You can capture data using the onboard radio memory buffer, which guarantees contiguous samples. Alternatively, you can bypass the buffer and capture data directly to the host computer. Use the UseRadioBuffer name-value argument to control the buffering behavior.
Only direct-to-host capture is supported in these scenarios:
The capture length exceeds the onboard radio memory buffer size.
Your are using a USRP X310 radio with TwinRX daughterboards and capture data on more than two antennas. This requirement is a hardware limitation.
When you capture data directly to the host, the performance you can achieve depends on the capability of your host computer. Factors such as network configuration and data transfer rate can affect your ability to capture data without dropping samples. Use this example to evaluate whether your physical setup supports direct‑to‑host capture at high sample rates.
Set Up Radio
Call the radioConfigurations function. The function returns all available radio setup configurations that you saved using the Radio Setup wizard.
savedRadioConfigurations = radioConfigurations;
To refresh the list of saved configurations, click Update, then select the radio to use with this example.
savedRadioConfigurationNames = [string({savedRadioConfigurations.Name})];
radioConfig =
savedRadioConfigurationNames(1)
;Create a radio object by calling the radioConfigurations function with the selected radio configuration name.
radio = radioConfigurations(radioConfig);
Configure Baseband Receiver
Create a baseband receiver application object with the radio object.
The baseband receiver requires exclusive access to the radio hardware. Before running this example for the first time, clear any other objects associated with the specified radio. In subsequent runs, reuse the existing workspace object to reduce execution time.
if ~exist("bbrx","var") bbrx = basebandReceiver(radio); end
Configure Behavior When Samples are Dropped
Set the DroppedSamplesAction property to 'none'. The default value is 'error', which stops the capture with an error message when samples are dropped.
bbrx.DroppedSamplesAction = 'none';Evaluate Performance at Multiple Sample Rates
Set the capture length to 2 GB.
captureLength = 2*2^28;
Select a set of sample rates based on the network connection you have configured using the Radio Setup wizard. If you are using a 10 Gigabit network connection, set the highest sample rate to the highest supported rate of your radio. If you are using a 1 Gigabit network connection, set the highest sample rate to 25 MHz.
The example iterates from the selected highest rate downward at and interval rate of 5 MHz until a capture completes without dropping samples. Large captures at lower sample rates can take some time. For example, a single 2 GB capture at a sample rate of 10 MHz will take over 54 seconds.
highSpeedTest =true; % Define the lowest sample rate once lowRate = 1e6; if ~highSpeedTest highRate =
25000000; intervalRate = 5e6; sampleRates = (highRate:-intervalRate:lowRate)'; else % Get maximum sample rate supported by the radio highRate =
hMaxSampleRate(radioConfig); intervalRate = 10e6; % Construct sample rates: max, half-max, then intervals down to lowRate sampleRates = [highRate; highRate/2; (highRate/2-intervalRate:-intervalRate:lowRate)']; % Remove duplicates if highRate/2 falls on an interval sampleRates = unique(sampleRates, 'stable'); end
To automatically retry failed captures, set retryUnsuccessfulCaptures to true.
retryUnsuccessfulCaptures =
true;Iterate through the sample rates, starting with the highest sample rate, until you successfully capture data without dropping samples. Set the UseRadioBuffer name-value argument to false to capture directly to host.
% Preallocate numRates = numel(sampleRates); successfulCapture = false(numRates,1); for idx = 1:numRates bbrx.SampleRate = sampleRates(idx); rateStr = num2str(bbrx.SampleRate/1e6, '%.2f'); % Format once disp(['Capturing at ' rateStr ' MHz']); % Attempt capture [~, ~, droppedSamples] = capture(bbrx, captureLength, UseRadioBuffer=false); % Retry if needed if retryUnsuccessfulCaptures && droppedSamples disp(['Retrying capture at ' rateStr ' MHz due to dropped samples']); [~, ~, droppedSamples] = capture(bbrx, captureLength, UseRadioBuffer=false); end successfulCapture(idx) = ~droppedSamples; % Exit loop after a successful capture if ~droppedSamples % Trim arrays to attempted rates only sampleRates = sampleRates(1:idx); successfulCapture = successfulCapture(1:idx); break; end end
Capturing at 153.60 MHz
Retrying capture at 153.60 MHz due to dropped samples
Capturing at 76.80 MHz
Tabulate Capture Results
Display the result in a table. The results identify the highest sample rate at which the hardware setup captures contiguous IQ data without dropping samples. Results can vary between runs.
sampleRatesMHz = sampleRates/1e6; captureResultsTable = table(sampleRatesMHz,successfulCapture); disp(captureResultsTable)
sampleRatesMHz successfulCapture
______________ _________________
153.6 false
76.8 true
For more information about how to optimize the transfer speed between the host computer and the radio, see Resolve Issues with Data Transfer.


