capture
Capture IQ data using baseband receiver or transceiver
Description
[
captures IQ data of length data
,timestamp
,droppedSamples
] = capture(bba
,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
.
Examples
Configure Baseband Receiver and Capture Data
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));
Configure Baseband Transceiver to Transmit and Capture Data
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);
Input Arguments
bba
— Baseband application
basebandReceiver
object | basebandTransceiver
object
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.
length
— Capture length
integer number of samples | duration
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
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™ N310 | 2 GB | 229 |
USRP N320 | 2 GB | 229 |
USRP N321 | 2 GB | 229 |
USRP X310 | 1 GB | 228 |
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 thetransmit
object function with thebba
input.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 or reduce the capture length.
Example: seconds(5)
Data Types: double
| duration
Output Arguments
data
— Captured signal
complex-valued column vector | complex-valued matrix
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. The number of antennas specified by theAntennas
property of thebba
input determines the number of matrix columns.
Use the bba
.CaptureDataType
property 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
timestamp
— Capture request timestamp
datetime
value
Capture request timestamp, returned as a datetime
value. The
function creates this timestamp just before requesting data capture from the
hardware.
Data Types: datetime
droppedSamples
— Status of dropped samples
1
| 0
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
input to specify the behavior of the function upon dropped
samples.
Data Types: logical
Version History
Introduced in R2022a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)