Main Content

capture

Capture RF signal data using USRP radio

Since R2023b

Description

example

[data,metadata] = capture(rx,length) captures ceil(length) continuous data samples using the USRP™ radio hardware associated with the rx receiver 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 metadata.

[data,metadata] = capture(rx,length,unit) specifies the capture length unit. The function converts length units into N samples and returns ceil(N) samples.

[data,metadata,timestamp] = capture(rx,length,unit) also returns the timestamp of each received sample from a USRP radio.

[data,metadata,timestamp] = capture(___,Filename=filename) saves the captured data and metadata to a baseband file reader file named filename, in addition to inputs from any of the prior syntaxes.

Examples

collapse all

Create an SDRu receiver System object. Set the master clock rate and center frequency.

rx = comm.SDRuReceiver(Platform ="X300",IPAddress ='192.168.60.2',...
                     CenterFrequency='2.4e9',MasterClockRate='184.32e6');

Capture 5 seconds of data.

[data,~]= capture(rx,5,'Seconds');
release(rx); 

Input Arguments

collapse all

Receiver, specified as a comm.SDRuReceiver System object. The function uses this object to communicate with the USRP radio connected to the host computer.

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 argument.

Data Types: double

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 rx. The function returns ceil(N) samples.

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 comm.BasebandFileReader System object. The saved file has the .bb extension.

Example: "rxdata" or "rxdata.bb" configures the function to save data to a file with the name rxdata and the .bb extension.

Data Types: char | string

Output Arguments

collapse all

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 rx. Each 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 rx.

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

Capture-time configuration settings for the SDR device, returned as a structure that contains these fields:

FieldDescription
Date

Date and time of the data capture.

BasebandSampleRate

Baseband sampling rate, in Hz, configured in the SDR device.

CenterFrequency

Center frequency, in Hz, configured in the SDR device.

DeviceName

Name of the SDR USRP device.

ChannelMapping

Channel mapping value configured in the SDR device.

CaptureLengthSamples

Capture length in samples.

CaptureLengthSeconds

Capture length in seconds.

SDRuReceiverConfiguration

List of property values and settings that describe the System object state.

Gain

Gain value, in dB, configured in the SDR device.

GainSource

Gain source value configured in the SDR device.

Data Types: struct

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 to "GPSDO".

  • To get the timestamp of each received sample from bundled radios, set the PPSSource property to "GPSDO" or "External".

Version History

Introduced in R2023b

expand all