capture
Add-On Required: This feature requires the Wireless Testbench™ Support Package for NI™ USRP™ Radios add-on.
Syntax
Description
[
captures a signal of interest of length data,timestamp,droppedSamples,status] = capture(detector,length,timeout)length from the air using the
preamble or energy detector detector with the detection timeout
timeout. The function returns the captured signal
data, capture request timestamp timestamp,
dropped samples status droppedSamples, and capture outcome status
status.
[
specifies the number of consecutive signals to capture, in addition to the input arguments
in the previous syntax. (since R2024a)data,timestamp,droppedSamples,status] = capture(___,NumCaptures=value)
Examples
Define a preamble sequence with good correlation properties. For example, generate and normalize a Zadoff-Chu sequence of length 137.
seq = zadoffChuSeq(38,137); preamble = seq/norm(seq,2);
Create and configure a preamble detector object, specifying a radio setup configuration previously saved in the Radio Setup wizard. Set the sample rate to 10.24 MHz and the center frequency to 2.2 GHz.
pd = preambleDetector("MyRadio")pd =
preambleDetector with properties:
Antennas: "RF0:RX2"
CenterFrequency: 2.4000e+09
SampleRate: 250000000
RadioGain: 10
Preamble: [16×1 double]
CaptureDataType: "int16"
TriggerOffset: 0
DroppedSamplesAction: "error"
ThresholdMethod: "adaptive"
TimestampUnit: "datetime"
AdaptiveThresholdOffset: 0
AdaptiveThresholdGain: 0
pd.SampleRate = 10.24e6;
pd.CenterFrequency = 2.2e9;
pd.CaptureDataType = "double";Specify the preamble.
pd.Preamble = preamble;
Set the trigger offset to a negative value to capture 500 samples before the trigger point.
pd.TriggerOffset = -500;
Capture 10 ms of data with a timeout of 1 s.
[data,timestamp,droppedSamples,status] = capture(pd,milliseconds(10),seconds(1));
Create and configure an energy detector object, specifying a radio setup configuration previously saved in the Radio Setup wizard.
ed = energyDetector("MyRadio")ed =
energyDetector with properties:
Antennas: "RF0:RX2"
CenterFrequency: 2.4000e+09
SampleRate: 250000000
RadioGain: 10
CaptureDataType: "int16"
WindowLength: 300
TriggerOffset: 0
DroppedSamplesAction: "error"
ThresholdMethod: "adaptive"
TimestampUnit: "datetime"
MinimumEnergy: 1.0000e-04
EnergyDeltaThreshold: 1
ed.SampleRate = 30.72e6;
ed.CenterFrequency = 2.45e9;
ed.CaptureDataType = "double";Set the energy increase threshold to 3 dB.
ed.EnergyDeltaThreshold = 3;
Set the trigger offset to a negative value to capture 100 samples before the trigger point.
ed.TriggerOffset = -100;
Capture 3 ms of data with a timeout of 1 s.
[data,timestamp,droppedSamples,status] = capture(ed,milliseconds(3),seconds(1));
Define a preamble sequence with good correlation properties. For example, generate and normalize a Zadoff-Chu sequence of length 137.
seq = zadoffChuSeq(38,137); preamble = seq/norm(seq,2);
Create and configure a preamble detector object, specifying a radio setup configuration previously saved in the Radio Setup wizard. Set the sample rate to 10.24 MHz and the center frequency to 2.2 GHz.
pd = preambleDetector("MyRadio",SampleRate=10.24e6,CenterFrequency=2.2e9)pd =
preambleDetector with properties:
Antennas: "RF0:RX2"
CenterFrequency: 2.2000e+09
SampleRate: 10240000
RadioGain: 10
Preamble: [16×1 double]
CaptureDataType: "int16"
TriggerOffset: 0
DroppedSamplesAction: "error"
ThresholdMethod: "adaptive"
TimestampUnit: "datetime"
AdaptiveThresholdOffset: 0
AdaptiveThresholdGain: 0
Specify the preamble.
pd.Preamble = preamble;
Capture ten consecutive signals with the specified preamble with a capture length of 5 ms and a timeout of 2 s.
[data,timestamp,droppedSamples,status] = capture(pd,milliseconds(5),seconds(2),"NumCaptures",10);Create and configure an energy detector object, specifying a radio setup configuration previously saved using the Radio Setup wizard. Set the data type of the captured data to double and the unit of the capture request timestamp to sample clock cycles.
ed = energyDetector("MyRadio",CaptureDataType="double",TimestampUnit="sample-clock-cycle")
ed =
energyDetector with properties:
Antennas: "RF0:RX2"
CenterFrequency: 2.4000e+09
SampleRate: 250000000
RadioGain: 10
CaptureDataType: "double"
WindowLength: 300
TriggerOffset: 0
DroppedSamplesAction: "error"
ThresholdMethod: "adaptive"
TimestampUnit: "sample-clock-cycle"
MinimumEnergy: 1.0000e-04
EnergyDeltaThreshold: 1
Capture five consecutive signals that meet the default thresholding criteria with a capture length of 1 ms and a timeout of 1 s.
[data,timestamp,droppedSamples,status] = capture(ed,milliseconds(1),seconds(1),"NumCaptures",5);Input Arguments
Detector, specified as one of the following:
preambleDetectorobjectenergyDetectorobject (since R2023b)
Note
The first object function call in which you specify this object as an input requires a few extra seconds to load the application onto the hardware.
Capture length, specified as an integer number of samples or a duration value in time units. The function converts
length into N samples based on the
SampleRate property of the detector input
and captures ceil(N) number of data
samples.
Specify the capture length relative to the onboard radio memory buffer size.
| Radio Device | Memory Buffer Size | Maximum Data Samples |
|---|---|---|
USRP™ N300 | 2 GB | 229 |
USRP N310 | 2 GB | 229 |
USRP N320 | 2 GB | 229 |
USRP N321 | 2 GB | 229 |
USRP X300 | 1 GB | 228 |
USRP X310 | 1 GB | 228 |
USRP X410 | 4 GB | 230 |
Note
The onboard radio memory buffers capture and transmit data samples. Therefore, when specifying the capture length, you must also account for the length of the transmit waveform of any continuous transmission that you specify when calling the
transmitobject function with thedetectorinput.If your host computer does not have enough free memory to receive the captured data from the radio buffer, the function call can hang or error out. To free up memory space on your host computer, try closing other software, reducing the capture length, or reducing the number of consecutive captures.
Example: seconds(5)
Data Types: double | duration
Signal detection timeout on the radio, specified as a duration value in time units.
When you set NumCaptures
to greater than 1 to capture consecutive signals from the air, the
timeout applies to the entire capture
operation. (since R2024a)
Note
If detector is a preambleDetector object, the property specifies a periodic signal. Set the
detection timeout to a value that is equal to or greater than the preamble signal
period. If the number of captures is set to a value greater than 1, set the detection
timeout to the preamble signal period multiplied by PreambleNumCaptures.
Setting the detection timeout to a value less than this can end the detection
operation prematurely.
Example: milliseconds(100)
Data Types: duration
Since R2024a
Number of consecutive signals to capture, specified as a positive integer. The
capture function identifies the signal of interest with the
detector input, captures N samples of IQ data
from the air based on the length input, and then waits until it
identifies the next signal of interest. The function repeats this process until it
captures NumCaptures signals or until it reaches the signal
detection timeout, timeout.
Note
The minimum time between the end of a capture operation and the start of the next signal that can be detected is 33 ns.
Data Types: double
Output Arguments
Captured signal, returned as one of these values, where N is the
integer number of samples defined by length.
An N-by-1 column vector of complex values if
NumCapturesis 1 (default).An N-by-
NumCapturescell array of complex values ifNumCapturesis greater than 1. (since R2024a)Note
If
timeoutis reached before the number of signals requested inNumCaptureshave been captured, the number of columns indatais equal to the number of successfully captured signals.
Use the CaptureDataType property of the
detector input to specify the output data type of the captured
data. If you specify the return data type as single or
double, the function scales the captured data sample values to the
range [–1, 1].
Data Types: int16 | single | double | cell
Complex Number Support: Yes
Capture request timestamp, returned as a datetime value, a column
vector of datetime values, sample clock cycles, or a column vector of
sample clock cycles.
Use the TimestampUnit property of the
detector input to specify the output data type of the capture
request timestamp.
If the
TimestampUnitproperty isdatetime(default) andNumCapturesis 1 (default), the function creates the initial timestamp just before requesting the first data capture from the hardware. The function returns this as adatetimevalue to nanosecond precision.If the
TimestampUnitproperty isdatetime(default) andNumCapturesis greater than 1, the function creates a timestamp just before it requests each data capture from the hardware. The function returns these as a column vector ofdatetimevalues to nanosecond precision. (since R2024a)If the
TimestampUnitproperty is set tosample-clock-cycleand multiple consecutive captures are requested with theNumCapturesname-value argument, the function first creates an initial timestamp of 0 just before requesting the first data capture from the hardware. For each subsequent capture, the function returns an integer number of clock cycles relative to the initial timestamp in a column vector. The sample clock rate is set by theSampleRateproperty of thedetectorinput. (since R2024a)Note
If
NumCapturesis not set or set to 1, the capture request timestamp is returned as adatetimevalue.
Data Types: datetime | uint64
Status of dropped samples, returned as one of these logical values.
1— Samples are dropped during capture.0— Samples are not dropped during capture.
Use the DroppedSamplesAction property of the
detector input to specify the behavior of the
capture function upon dropped samples.
Data Types: logical
Number of successful captures, returned as a positive integer. If
NumCaptures is 1 (default), status is
returned as one of the following values:
1 — The capture operation was successful and the captured signal of interest is returned in
data.0 — The detect and capture operation timed out.
If NumCaptures is set to
a value greater than 1, status is returned as the number of
successful captures completed before the capture operation timed out. (since R2024a)
Version History
Introduced in R2022aSpecify the NumCaptures
name-value input argument to capture multiple consecutive signals with detectors.
The function accepts an energyDetector object
as an input argument.
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)