wirelessIQLogger
Description
Use the wirelessIQLogger object to log in-phase and quadrature
(IQ) samples from the physical layer of wireless nodes in a wireless network simulation. The
wirelessIQLogger object captures IQ samples of the received signal at a
node. It does not log the transmitted waveform IQ samples.
Creation
Description
wirelessIQLogger(wirelessNode) creates a default IQ logger object
to log IQ samples from the physical layer of wireless nodes during simulation run
time.
wirelessIQLogger(
sets properties using one or more optional name-value arguments. For example,
wirelessNode,PropertyName=Value)FileName="ueIQSamples" sets the name of the MAT file used for storing
IQ samples to ueIQSamples.
Input Arguments
Wireless node, specified as an object of a subclass of the
wnet.Node class, or a vector of a subclass of
wnet.Node.
If you specify this argument as a vector, the object does not support logging if any of the nodes in that vector has multiple physical layers (PHYs).
Properties
This property is read-only after object creation.
File in which to store IQ samples, specified as a character row vector, string scalar, or vector of strings.
If you do not specify the FileName argument, the object assigns
default file names to all nodes and to all PHYs inside each node. It uses the format
NodeName_NodeID_CenterFrequency_Bandwidth_YYYYMMDD_HHMMSS, where:
NodeName — Name of the node.
NodeID — Unique identifier of the node.
CenterFrequency — Center frequency.
Bandwidth — Channel bandwidth.
YYYYMMDD — Year, month, and day when the object creates the file.
HHMMSS — Hour, minute, and second when the object creates the file.
The object maps these file names to the nodes or PHYs in the order you specify them.
When you specify multiple nodes, the object logs the IQ samples for each node in a
separate file. If you specify FileName as a string vector with fewer
filenames, than the number of nodes, the object assigns default names for the remaining
PHYs.
If you specify more file names than nodes in the input, the object ignores the
excess file names. The object maps each FileName to nodes in the
same order as provided. If you provide the same name for multiple nodes, the object
throws an error. If wirelessNode is a scalar with multiple PHYs,
specify the value as a vector of strings. The object then maps each
FileName to PHYs in the same order.
Data Types: string | char
This property is read-only after object creation.
Sample rate for logging IQ samples, specified as a positive scalar. Units are in Hz.
When you do not specify SampleRate, the object logs IQ samples at the
operating sample rate of the PHY. The sample rate must be greater than or equal to
1e6.
Data Types: double
Examples
Log and display in-phase and quadrature (IQ) samples in a 5G NR link-level simulation. Initialize a wireless network simulator with a base station (gNB) and a user equipment (UE) node, configure their physical layers, and establish a connection between them. Set up a random waypoint mobility model for the UE and generate voice-over-IP (VoIP) traffic. Use wirelessIQLogger to record IQ samples at the UE. After running the simulation, load the saved IQ data and display the first 10 IQ samples to inspect the received waveform.
Initialize the wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create a gNB node with default settings.
gnb = nrGNB(PHYModel="full-phy");Create a UE node with default settings.
ue = nrUE(PHYModel="full-phy");Add a random waypoint mobility model to the UE node.
addMobility(ue,BoundaryShape="rectangle")Establish a connection between the UE and gNB nodes.
connectUE(gnb,ue)
Create a voice over Internet protocol (VoIP) application traffic pattern object.
traffic = networkTrafficVoIP;
Add the data traffic source to the gNB node. Set the destination node as the UE node.
addTrafficSource(gnb,traffic,DestinationNode=ue)
Add the gNB node to the wireless network simulator.
addNodes(networkSimulator,gnb)
Add the UE node to the wireless network simulator.
addNodes(networkSimulator,ue);
If IQ log files already exist, delete them.
if exist('ueIQ.mat','file') delete('ueIQ.mat'); end
Create an IQ logger for the UE node to log IQ samples during simulation runtime
wirelessIQLogger(ue,FileName="ueIQ.mat",SampleRate=20e6);Specify the simulation time, in seconds.
simulationTime = 0.3;
Run the simulation for the specified simulation time.
run(networkSimulator,simulationTime)
Load the UE IQ samples
ueIQData = load("ueIQ.mat")ueIQData = struct with fields:
Fs: 20000000
Metadata: [1×1 struct]
Waveform: [6000000×1 single]
Display the first 10 IQ samples.
disp('First 10 IQ samples (complex values):');First 10 IQ samples (complex values):
disp(ueIQData.Waveform(1:10));
-0.3237 + 0.1305i -0.2396 + 0.2205i -0.0313 + 0.2944i 0.1876 + 0.3184i 0.3211 + 0.2738i 0.3500 + 0.1679i 0.3118 + 0.0297i 0.2452 - 0.1019i 0.1645 - 0.1903i 0.0796 - 0.2072i
Log and analyze in-phase and quadrature (IQ) samples in a Bluetooth low energy (LE) network simulation. Begin by configuring a Bluetooth network that includes a Central node and a Peripheral node, specifying their positions and mobility patterns. Add On-Off application traffic from the Central to the Peripheral node, and use a wirelessIQLogger object to capture IQ samples at the peripheral receiver. After running the simulation, load the recorded IQ data, and display the first 10 samples to examine the characteristics of the received waveform.
Initialize the simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create Bluetooth nodes.
centralNode = bluetoothLENode("central"); peripheralNode = bluetoothLENode("peripheral",Position=[1 0 0]);
Add mobility to the Peripheral node.
addMobility(peripheralNode,BoundaryShape="circle");Create and configure a connection.
cfgConnection = bluetoothLEConnectionConfig
cfgConnection =
bluetoothLEConnectionConfig with properties:
ConnectionInterval: 0.0200
AccessAddress: "5DA44270"
UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
Algorithm: 1
HopIncrement: 5
CRCInitialization: "012345"
SupervisionTimeout: 1
PHYMode: "LE1M"
InstantOffset: 6
ConnectionOffset: 0
ActivePeriod: 0.0200
MaxPDU: 251
TIFS: 1.5000e-04
TMCES: 1.5000e-04
configureConnection(cfgConnection,centralNode,peripheralNode);
Configure On-Off traffic.
traffic = networkTrafficOnOff(DataRate=200,PacketSize=27,OnTime=inf);
Add On-Off traffic from the Central to Peripheral node.
addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode)
Add the nodes to the simulator.
addNodes(networkSimulator,[centralNode peripheralNode])
If an IQ log file already exists, delete it.
if exist('peripheralIQ.mat','file') delete('peripheralIQ.mat'); end
Create an IQ logger for the Peripheral node to log IQ samples during simulation runtime.
iqFile = "peripheralIQ.mat";
peripheralIQLogger = wirelessIQLogger(peripheralNode,FileName=iqFile);Set the simulation time, in seconds, and run the simulation.
simulationTime = 0.3; run(networkSimulator,simulationTime);
Load and display the first 10 IQ samples from Peripheral node.
iqData = load(iqFile)
iqData = struct with fields:
Fs: 80000000
Metadata: [1×1 struct]
Waveform: [24000000×1 single]
disp("First 10 IQ samples (complex values):")First 10 IQ samples (complex values):
disp(iqData.Waveform(1:10))
0.0006 - 0.0001i -0.0006 - 0.0006i -0.0002 + 0.0009i 0.0007 - 0.0003i -0.0004 - 0.0004i -0.0001 + 0.0003i 0.0002 + 0.0000i -0.0003 - 0.0002i 0.0000 + 0.0008i 0.0012 - 0.0007i
Copyright 2024 The MathWorks, Inc.
Configure a wireless local area network (WLAN) with multilink access point (AP) and station (STA) nodes, and log in-phase and quadrature (IQ) samples at the STA receiver. After setting up the nodes and enabling downlink traffic, you create an IQ logger to capture received samples during the simulation. You can then use the recorded IQ data for further analysis.
Initialize the network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create a WLAN node with AP device configuration.
apDeviceCfg = wlanDeviceConfig(Mode="AP"); apNode = wlanNode(Name="AP", DeviceConfig=apDeviceCfg, ... MACModel="full-mac", PHYModel="full-phy");
Create a WLAN node with STA device configuration.
staDeviceCfg = wlanDeviceConfig(Mode="STA"); staNode = wlanNode(Name="STA", DeviceConfig=staDeviceCfg, ... MACModel="full-mac", PHYModel="full-phy");
Associate the STA node with the AP node, and enable downlink full buffer traffic.
associateStations(apNode,staNode,FullBufferTraffic="on");Add the nodes to the simulator.
addNodes(networkSimulator,[apNode, staNode]);
If an IQ log files already exists, delete it.
iqFile = "staIQ.mat"; if exist(iqFile, 'file') delete(iqFile); end
Create an IQ logger for the STA node to log received IQ data.
staIQLogger = wirelessIQLogger(staNode,FileName=iqFile);
Set the simulation time, in seconds, and run the simulation.
simulationTime = 0.01; % seconds
run(networkSimulator,simulationTime);Load IQ samples from the STA node.
iqData = load(iqFile)
iqData = struct with fields:
Fs: 20000000
Metadata: [1×1 struct]
Waveform: [200000×1 single]
Version History
Introduced in R2026a
See Also
Objects
nrGNB(5G Toolbox) |nrUE(5G Toolbox) |wlanNode(WLAN Toolbox) |bluetoothLENode(Bluetooth Toolbox) |wirelessNetworkSimulator
Topics
- Log IQ Samples and Visualize in Signal Analyzer (Bluetooth Toolbox)
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)