Main Content


Capture RF signal data using SDR device

Since R2019b

Add-On Required: This feature requires the Communications Toolbox Support Package for Analog Devices ADALM-Pluto Radio add-on.


[data,mdata] = capture(rxsdr,length) uses the rxsdr System object™ and SDR device to capture the number of data samples specified by length. The mdata output structure contains capture-time configuration settings for the SDR device.

[___] = capture(rxsdr,length,unit) also specifies the unit value for the capture length using any of the prior syntaxes. If length units corresponds to a fractional number of samples, ceil(length) is returned.


[data,mdata,fn] = capture(___,'Filename',filename) specifies filename, a file name for the captured data, in addition to inputs from any of the prior syntaxes. The function saves the captured data to a baseband file reader file named fn.

[___] = capture(___,'Filename',filename,Name,Value) specifies options using one or more name-value pair arguments. For example, 'UserMetadata',moreInfo adds the moreInfo structure defined in the workspace to the mdata output. Specify name-value pair arguments after all other input arguments.


collapse all

Use the capture function and an ADALM-PLUTO radio to record RF signals for post-capture processing in MATLAB®. Save an FM broadcast signal to a file as baseband samples. Read the file containing the recorded signal and demodulate the baseband samples.

Configure SDR Hardware

To configure your ADALM-PLUTO radio for host-radio communication, see Guided Host-Radio Hardware Setup.

Attach an antenna suitable for the 88-108 MHz band to the first RX channel. The FM radio band is outside the default tuning range for the ADALM-PLUTO radio. The configurePlutoRadio function enables you to extend the frequency range and use your ADALM-PLUTO radio outside the qualified tuning range. The extended frequency range includes the full FM radio band.

## Establishing connection to hardware. This process can take several seconds.

Configure Receiver System Object

Create an SDR receiver System object with the specified properties. The specified center frequency corresponds to a local FM station.

deviceName = 'Pluto';
samplerate = 528e3;
fmStationFrequency = 88.9e6; % Adjust to select an FM station nearby
rx = sdrrx(deviceName,'BasebandSampleRate',samplerate, ...

Initiate Data Capture to File

Call the capture function, specifying the receiver object, capture duration, and file name. After capturing the FM signal, unlock the receiver object using the release function.

## Establishing connection to hardware. This process can take several seconds.

Demodulate FM Recording

Create a comm.BasebandFileReader System object to read the captured signal and extract frames of data from the file. Set baseband file reader to take 4400 samples per frame when reading the saved baseband signal.

bbr = comm.BasebandFileReader('');
bbr.SamplesPerFrame = 4400;

Use the BasebandSampleRate field of the baseband file reader object to set the SampleRate property of the demodulator. Find the BasebandSampleRate field in the MetaData structure. Create a comm.FMBroadcastDemodulator System object. Demodulate and play back each frame of the FM data. Use a while loop to read all frames of the captured data.

fmbDemod = comm.FMBroadcastDemodulator('AudioSampleRate',48e3, ...
while ~isDone(bbr)

Input Arguments

collapse all

Software-defined radio receiver, specified as a comm.SDRRxPluto System object. The function uses this object to communicate with the SDR device connected to the host computer.

Capture duration, specified as a scalar. The input argument unit specifies the unit of length. The default unit is samples of data. The number of samples to capture must be in the range [1, 16,777,216]. Use the 'EnableOversizeCapture' name-value pair to remove the limit on the maximum number of samples to capture. However, this does not guarantee data contiguity.

Data Types: double

Capture duration unit, specified as:

  • 'Samples' — The function interprets length to be the number of data samples to capture, NS.

  • 'Seconds' — The function interprets length in seconds and computes the number of data samples to capture, NS = ceil(length × RS), where RS is the BasebandSampleRate property of the rxsdr object.

File name for the captured data, specified as a character vector or string scalar. The function saves the captured data. To read this file, use the comm.BasebandFileReader System object. The saved file has the file name extension .bb.

Example: 'rxdata' or '' configures the function to save data to a file named

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: [data,mdata,fn] = capture(rxsdr,5,'Filename','RFCapture','Timestamp',true)

Append a capture time stamp to the saved file name, specified as the comma separated pair consisting of 'Timestamp' and false or true.

  • When you specify false, no timestamp is appended to the saved file name.

  • When you specify true, the name of the created file takes the form <filename>_<Year>-<Month>-<Day>_<Hour>-<Minute>-<Second>-<Millisecond>.bb and indicates when the data was captured.

Data Types: logical

User data, specified as the comma separated pair consisting of 'UserMetadata' and a single-level structure of data that is added to the mdata structure output. By default there is no user data structure included in mdata.

Data Types: struct

Remove limit on capture duration, specified as the comma separated pair consisting of 'EnableOversizeCapture' and false or true. When you specify true, the function removes the limit on the number of samples and data contiguity is not guaranteed.

Data Types: logical

Output Arguments

collapse all

Received data, returned as a vector of complex values. The value range depends on the data type of the output.

  • int16 — Output data consists of 16-bit signed integer values in the range [–2048, 2047]. The AD936X RF chip has a 12-bit ADC. The 12-bit data from the ADC is stored in the lower 12 bits of the output value and sign-extended to 16 bits.

  • double — Output data consists of double-precision floating point values scaled to the range of [–1, 1].

  • single — Output data consists of single-precision floating point values scaled to the range of [–1, 1].


The AD936X RF chip has a 12-bit ADC. Double-precision and single-precision floating point representations of received data values are directly created from the sign-extended int16 value received from the board. These representations occupy only the range [–1, 1].

The rxsdr object specifies the data type of the received data with the OutputDataType property.

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

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


Date of the data capture.


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


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


Name of the SDR device.


Channel mapping value configured in the SDR device. Channel mapping is always 1.


Capture length in samples.


Capture length in seconds.


Character vector list of property values and settings that describe the System object state.


Gain source value configured in the SDR device.


0 indicates the data is not contiguous.

1 indicates the data is contiguous.

DiscontiguityIndicesVector of indices into the output data. This field only applies when the DataContiguity field is 0. Each index indicates that on or after the corresponding data sample a discontiguity occurs.
UserMetaDataAdditional structure containing user-defined information included as an input to the capture function.

Data Types: struct

File name of captured data, returned as a character vector.

Data Types: char

Version History

Introduced in R2019b