Main Content

capture

Capture IQ data using baseband receiver or transceiver

Since R2022a

Description

example

[data,timestamp,droppedSamples] = capture(bba,length) captures IQ data of length length from the air using the specified baseband receiver or baseband transceiver bba. The function returns the captured signal data, capture request timestamp timestamp, and dropped samples status droppedSamples.

example

[pathToSavedData,timestamp,droppedSamples] = capture(bbrx,length,SaveLocation=filepath) captures IQ data of length length from the air using the specified baseband receiver bbrx. The function returns the path to the file where the captured signal is written pathToSavedData, capture request timestamp timestamp, and dropped samples status droppedSamples. (since R2023b)

Examples

collapse all

Create a baseband receiver object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

bbrx = basebandReceiver("MyRadio")
bbrx = 
  basebandReceiver with properties:

               RadioGain: 10
         CenterFrequency: 2.4000e+09
              SampleRate: 250000000
                Antennas: "RF0:RX2"
    DroppedSamplesAction: "error"
         CaptureDataType: "int16"

Set the baseband sample rate and center frequency.

bbrx.SampleRate = 122.88e6;
bbrx.CenterFrequency = 2.2e9;

Capture 3 ms of IQ data with the radio associated with the baseband receiver object using the default antenna.

[data,~] = capture(bbrx,milliseconds(3));

Create a baseband transceiver object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

bbtrx = basebandTransceiver("MyRadio")
bbtrx = 
  basebandTransceiver with properties:

          TransmitRadioGain: 10
    TransmitCenterFrequency: 2.4000e+09
           TransmitAntennas: "RF0:TX/RX"
           CaptureRadioGain: 10
     CaptureCenterFrequency: 2.4000e+09
            CaptureAntennas: "RF0:RX2"
            CaptureDataType: "int16"
       DroppedSamplesAction: "error"
                 SampleRate: 250000000

Set the baseband sample rate.

bbtrx.SampleRate = 122.88e6;

Set the transmit and capture center frequencies.

bbtrx.TransmitCenterFrequency = 2.2e9;
bbtrx.CaptureCenterFrequency = 2.2e9;

Generate random transmit waveform.

txWaveform = complex(randn(1000,1),randn(1000,1));

Transmit the generated waveform continuously with the radio associated with the baseband transceiver object using the default transmit antenna.

transmit(bbtrx,txWaveform,"continuous");

Capture IQ data with the radio associated with the baseband transceiver object using the default capture antenna.

[data,~] = capture(bbtrx,milliseconds(3));

Stop the continuous transmission after data capture is complete.

stopTransmission(bbtrx);

Create a baseband receiver object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

bbrx = basebandReceiver("MyRadio")
bbrx = 
  basebandReceiver with properties:

               RadioGain: 10
         CenterFrequency: 2.4000e+09
              SampleRate: 250000000
                Antennas: "RF0:RX2"
    DroppedSamplesAction: "error"
         CaptureDataType: "int16"

Capture 100 ms of IQ data and save it to a file in the basebandData folder called capture1.mat.

mkdir('basebandData');
[dataPath,~] = capture(bbrx,milliseconds(100),SaveLocation='basebandData/capture1.mat');

Load the data into the workspace.

load(dataPath,'data');

Input Arguments

collapse all

Baseband application, specified as a basebandReceiver object or basebandTransceiver object.

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 bba or bbrx input and captures ceil(N) number of data samples.

If the baseband application is a baseband receiver, the capture behavior depends on the capture length relative to the onboard radio buffer size.

  • If you specify the capture length less than the onboard radio memory buffer size, data is buffered on the radio before it is transferred to your host computer.

  • If you specify the capture length greater than the onboard radio memory buffer size, the onboard radio memory buffer is bypassed and data is transferred directly to your host computer. (since R2023b)

Radio DeviceMemory Buffer SizeMaximum Data Samples

USRP™ N310

2 GB229

USRP N320

2 GB229

USRP N321

2 GB229

USRP X310

1 GB228

USRP X410

4 GB230

Note

  • Transmit and capture data samples on the baseband transceiver are buffered in the onboard radio memory. Therefore, if the bba input is a baseband transceiver, you must also take into account the length of the transmit waveform of any continuous transmission that you specify when calling the transmit object function.

  • If you specify length greater than the radio buffer size with a baseband receiver object, the maximum data samples will be determined by the memory on your host computer.

  • If your host computer does not have enough free memory to receive the captured data, the function call can hang or error out. To free up memory space on your host computer, try closing other software or reduce the capture length.

Example: seconds(5)

Data Types: double | duration

Baseband receiver, specified as a basebandReceiver object.

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.

Path to MAT-file including file name, specified as a character vector or string scalar. Specify a full or relative path that contains a file name. If filepath does not include an extension, it appends with .mat.

If the file does not exist, capture creates a Version 7.3 MAT-file. If the file already exists, capture overwrites the file with a Version 7.3 MAT-file.

Example: 'capture1.mat'

Data Types: char | string

Output Arguments

collapse all

Captured signal, returned as one of these options.

  • Complex-valued column vector — The vector contains data that is captured on a single capture antenna.

  • Complex-valued matrix — The matrix contains data that is captured on multiple capture antennas. This option applies only when bba is a baseband receiver or bbrx is the input object. The number of antennas specified by the Antennas property of the bba or bbrx input determines the number of matrix columns.

Use the CaptureDataType property of the bba or bbrx to specify the data type of the returned 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].

Note

The first data samples of the captured signal can contain transient values from the radio data path.

Data Types: int16 | single | double
Complex Number Support: Yes

Capture request timestamp, returned as a datetime value. The function creates this timestamp just before requesting data capture from the hardware.

Data Types: datetime

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 bba or bbrx input to specify the behavior of the function upon dropped samples.

Data Types: logical

Path to MAT-file where capture data is saved, returned as a character vector. The full path is returned, including the file name and extension.

Example: 'H:/user/matlab/capture1.mat'

Data Types: char

Version History

Introduced in R2022a

expand all