Capture RF signal data using USRP radio
metadata] = capture(
ceil( continuous data samples
using the USRP™ radio hardware associated with the
System object™. The function returns the captured data samples in the output
data. The function also returns capture-time configuration settings
for the radio device in the output
Capture WLAN Signals Using USRP Radio Hardware
Use the capture function and a USRP™ radio to capture WLAN signals.
Configure SDR Hardware
If your radio hardware is already configured for host-radio communication, skip this section. To configure your radio hardware for host-radio communication, follow the steps in the Guided USRP Radio Support Package Hardware Setup. Attach an antenna suitable for the 2.4GHz band to the first RX channel.
Configure Receiver System Object
Create a receiver System object and set the center frequency to 2.4GHz.
centerFrequency = 2.4e9; rx = comm.SDRuReceiver(Platform = 'B210',SerialNum = '3136D5F',... MasterClockRate = 60e6,DecimationFactor = 3,... CenterFrequency = centerFrequency,... OutputDataType = 'single',Gain=61);
Initiate Data Capture
capture function, specifying the receiver object and a capture duration. The function returns the captured data, the configuration settings in the structure
metadata, and the timestamp of each received sample in a column vector
timestamp. After capturing the WLAN signal, unlock the receiver object by using the
linux; GNU C++ version 10.3.0; Boost_107800; UHD_220.127.116.11-vendor ---------- see libuhd version information above this line ----------
To calculate the sample rate, divide the master clock rate by decimation factor. Use the
spectrumAnalyzer System object to visualize the received WLAN signal.
sampleRate = rx.MasterClockRate/rx.DecimationFactor; scope = spectrumAnalyzer(SampleRate=sampleRate); scope(data) release(scope);
rx — Receiver
Receiver, specified as a
System object. The function uses this object to communicate with the USRP radio connected to the host computer.
length — Capture duration
Capture duration, specified as a positive scalar. The maximum number of samples you
can capture is
256e6. When you set the ChannelMapping property,
the object restricts the number of samples per channel to equal fractions of
256e6 divided by the number of channels. Specify the unit of
capture duration as samples or seconds in the
unit — Capture duration unit
"Samples" (default) |
filename — Filename for saving captured data and metadata
character vector | string scalar
Filename for saving captured data and metadata, specified as a character vector or
string scalar. When you specify this input, the function saves the captured data and
metadata to a baseband file. To read this file, use the
System object. The saved file has the
"rxdata.bb" configures the
function to save data to a file with the name
rxdata and the
data — Output signal
Output signal received from the radio hardware, returned as a complex-valued matrix.
The number of columns in the matrix depends on the number of channels in use, as
specified by the ChannelMapping property
of the input receiver
column corresponds to a channel of complex data received on one channel. The number of
rows equals the length of received data.
The output signal supports complex values with these data types:
8-bit signed integers — Output values are the raw 8-bit I and Q samples from the board.
16-bit signed integers — Output values are the raw 16-bit in-phase (I) and quadrature phase (Q) samples from the USRP radio.
Single-precision floating point — Scaled output values in the range [–1, 1].
Double-precision floating point — Scaled output values in the range [–1, 1].
To specify the base data type, use the OutputDataType property
of the input receiver
Complex Number Support: Yes
metadata — Capture-time configuration settings for SDR device
Capture-time configuration settings for the SDR device, returned as a structure that contains these fields:
Date and time of the data capture.
Baseband sampling rate, in Hz, configured in the SDR device.
Center frequency, in Hz, configured in the SDR device.
Name of the SDR USRP device.
Channel mapping value configured in the SDR device.
Capture length in samples.
Capture length in seconds.
List of property values and settings that describe the System object state.
Gain value, in dB, configured in the SDR device.
Gain source value configured in the SDR device.
timestamp — Timestamp of each received sample
Timestamp of each received sample, returned as a column vector. The length of this output equals the length of received data.
Introduced in R2023b