[data,metadata] = capture(rx,length)
captures ceil(length) continuous data samples
using the USRP™ radio hardware associated with a comm.SDRuReceiver
System object™
rx. The function returns the captured data samples,
data, and the capture-time configuration settings for the radio
device, metadata.
[data,metadata] = capture(rx,length,unit)
specifies the capture length unit, unit, in addition to the input
arguments in the previous syntax. The function converts length units
into N samples and returns
ceil(N) samples.
[data,metadata,timestamp] = capture(rx,length,unit)
returns the timestamp of each received sample from a USRP radio, timestamp, in addition to the output arguments
in the previous syntaxes.
First, configure your radio hardware for host-radio communication by following the steps in Guided USRP Radio Support Package Hardware Setup. Create a comm.SDRuReceiver System object for your USRP radio.
Use the capture function and a USRP™ radio to capture WLAN signals.
Configure SDR Hardware
To configure your radio hardware for host-radio communication, see Guided USRP Radio Support Package Hardware Setup. Attach an antenna that is compatible with the 2.4 GHz band to the first RX channel.
Configure Receiver System Object
Create a receiver System object and set the center frequency to 2.4 GHz.
Call the capture function by specifying the receiver object and a capture duration. The function returns the captured data in 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 release function.
linux; GNU C++ version 10.3.0; Boost_107800; UHD_4.2.0.0-vendor
---------- see libuhd version information above this line ----------
release(rx);
To calculate the sample rate, divide the master clock rate by the decimation factor. Use the spectrumAnalyzer System object to visualize the received WLAN signal.
Receiver, specified as a comm.SDRuReceiver
System object. The capture function uses this object to
communicate with the USRP radio connected to the host computer.
length — Capture duration positive scalar
Capture duration, specified as a positive scalar. Specify the unit of capture
duration as samples or seconds using the unit
input argument.
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.
Data Types: double
unit — Capture duration unit "Samples" (default) | "Seconds"
Capture duration unit, specified as one of these values:
"Samples" — The function returns
ceil(length)
samples.
"Seconds" — The function converts
length seconds into N samples based on
the BasebandSampleRate property of the input receiver
System object
rx. The
function returns ceil(N) samples.
filename — File name for saving captured data and metadata string scalar | character vector
File name for saving captured data and metadata, specified as a string scalar or
character vector. Use this option to save the captured data and metadata to a baseband
file. If the file name does not include an extension, the function appends the file name
with .bb.
Output signal, returned as a complex-valued matrix. The number of columns in the
matrix depends on the number of channels specified by the
ChannelMapping property of the input receiver System object
rx. Each column
contains the complex data received on one channel. The number of rows is equal to the
length of the received data.
The output signal supports complex values with these data types:
8-bit signed integers — data is the raw 8-bit in-phase
(I) and quadrature phase (Q) samples from the board.
16-bit signed integers — data is the raw 16-bit I and Q
samples from the USRP radio.
Single-precision floating point — data is the scaled
output values in the range [–1, 1].
Double-precision floating point — data is the scaled
output values in the range [–1, 1].
To specify the data type, use the OutputDataType
property of the input receiver System object
rx.
Data Types: int8 | int16 | single | double Complex Number Support: Yes
metadata — Capture-time configuration settings for radio device structure
Capture-time configuration settings of the radio device, returned as a structure
containing these fields. The radio device is the USRP radio associated with the input receiver rx.
Field
Description
Date
Date and time of the data capture.
DeviceName
Model number of the USRP radio device.
ChannelMapping
Channel mapping value of the radio device.
BasebandSampleRate
Baseband sample rate in Hz of the radio device.
CaptureLengthSamples
Capture length in samples.
CaptureLengthSeconds
Capture length in seconds.
CenterFrequency
Center frequency in Hz of the radio device.
GainSource
Gain source of the radio device, returned as either "Input
Port" or "Property".
Gain
Gain value in dB of the radio device.
SDRuReceiverConfiguration
Structure than includes the property values and settings that
describe the System object state of the input receiver
rx.
Data Types: struct
timestamp — Timestamp of each received sample column vector
Timestamp of each received sample, returned as a column vector.
The length of this output equals the length of received data.
To get the GPS timestamp of each received sample from a USRP radio, set the
PPSSource property of the input receiver System object
rx to
"GPSDO".
To get the timestamp of each received sample from bundled radios, set the
PPSSource property of the input receiver System object
rx to "GPSDO" or
"External".
R2024a: Support for N3xx and X3xx series radio devices moved to Wireless Testbench
Support for NI™
USRP N3xx and X3xx series radio devices has moved from Communications Toolbox™ Support Package for USRP Radio to Wireless Testbench™ Support Package for NI
USRP Radios.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.