Capture contiguous RF data using USRP® embedded series radio hardware
mdata] = capture(
ceil( number of contiguous data
samples using the USRP®
embedded series radio hardware associated with the
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 structure
capture function 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
If your radio hardware is already configured for host-radio communication, you can skip this section. To configure your radio hardware for host-radio communication, follow the steps in the Guided Host-Radio Hardware Setup. Attach an antenna suitable for the 88-108 MHz band to the first RX channel.
Configure Receiver System Object
Create a receiver System object with the specified properties. The specified center frequency corresponds to a local FM station.
stationCenterFrequency = 95e6; deviceName = 'E3xx'; rx = sdrrx(deviceName,'BasebandSampleRate',528e3,... 'CenterFrequency',stationCenterFrequency,'OutputDataType','Double');
Initiate Data Capture to File
capture function, specifying the receiver object, capture duration, and file name. The function returns the captured data in a file named "FMRecording.bb". After capturing the FM signal, unlock the receiver object using the
## Establishing connection to hardware. This process can take several seconds.
Demodulate FM Recording
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('FMRecording.bb'); bbr.SamplesPerFrame = 4400;
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, ... 'SampleRate',bbr.Metadata.BasebandSampleRate,'PlaySound',true); while ~isDone(bbr) fmbDemod(bbr()); end
length— Capture duration
Capture duration, specified as a scalar. The input argument
unit specifies the unit of
default unit is samples of data. The maximum number of samples to capture is in the
range [1, 16,777,216]. You can remove the limit on the maximum number of samples to
capture but at the cost of guaranteed data contiguity. For more details, see the
EnableOversizeCapture' name-value pair argument.
unit— Capture duration unit
filename— File name for captured data
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
object. The saved file has the file name extension
'rxdata.bb' configures the
function to save data to a file named
comma-separated pairs of
the argument name and
Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
[data,mdata,fn] = capture(rxsdr,5,'Filename','RFCapture','Timestamp',true)
'Timestamp'— Append capture time stamp to saved file name
Append a capture time stamp to the saved file name, specified as the comma
separated pair consisting of '
When you specify
false, no timestamp is appended to the
saved file name.
When you specify
true, the name of the created file takes
and indicates when the data was captured.
'UserMetadata'— User data
User data, specified as the comma separated pair consisting of
UserMetadata' and a single-level structure of data that is added
mdata structure output. By default there is no user data
structure included in
'EnableOversizeCapture'— Remove limit on capture duration
Remove limit on capture duration, specified as the comma separated pair consisting
true. When you specify
true, the function
removes the limit on the number of samples and data contiguity is not
data— Output signal
Output signal received from the radio hardware, returned as a complex matrix. The
number of columns in the matrix depends on the number of channels in use, as specified
ChannelMapping property of the receiver object
rx. Each column corresponds to a channel of complex data received
on one channel.
The output signal supports complex values with these data types:
16-bit signed integers — Complex values are the raw 16-bit I and Q samples from the board. The 12-bit value from the ADC of the AD9361 RF chip is sign-extended to 16 bits.
Single-precision floating point — Complex values are scaled to the range of [–0.0625, 0.0625]. The object derives this value from the sign-extended 16 bits received from the board.
Double-precision floating point — Complex values are scaled to the range of [–0.0625, 0.0625]. The object derives this value from the sign-extended 16 bits received from the board.
To specify the base type, use the
property of the receiver object
Complex Number Support: Yes
mdata— Capture-time configuration settings for radio device
Capture-time configuration settings for the radio 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.
Character vector list of property values and settings that describe the System object state.
Gain source value configured in the SDR device.
|Additional structure containing user-defined information included as an
input to the |
fn— File name for saved captured data and metadata
File name for saved captured data and metadata, returned as a character vector.
 USRP, USRP2, UHD, and Ettus Research are trademarks of National Instruments Corp.