lrwpanWaveformGenerator
Syntax
Description
generates a waveform for the specified input, wave
= lrwpanWaveformGenerator(data
,cfg
)data
, and
physical layer (PHY) format configuration, cfg
. For more
information, see IEEE 802.15.4 PPDU Format.
specifies additional options using one or more name-value pair arguments. For
example, wave
= lrwpanWaveformGenerator(data
,cfg
,Name=Value
)lrwpanWaveformGenerator(data,cfg,NumPackets=30)
specifies a waveform containing 30 PPDU packets.
Examples
Create OQPSK IEEE 802.15.4 Waveform
Generate random data for a PHY Service Data Unit (PSDU) payload. Create an OQPSK IEEE 802.15.4 lrwpanOQPSKConfig
object. Create an OQPSK IEEE 802.15.4 waveform.
psdu = randi([0,1],127*8,1); spc = 8; cfgOQPSK = lrwpanOQPSKConfig( ... SamplesPerChip=spc, ... PSDULength=length(psdu)/8); % PSDU length in bytes
Generate an OQPSK IEEE 802.15.4 waveform by using the lrwpanWaveformGenerator
function and cfgOQPSK
configuration object. The waveform generator loops PSDU length as needed to use all input PSDU payload bits. Display the waveform by using the eyediagram
function.
waveOQPSK = lrwpanWaveformGenerator(psdu,cfgOQPSK); eyediagram(waveOQPSK(1+spc:end-spc), 2*spc);
Create HPRF IEEE 802.15.4z Waveform
Generate random data for a PHY Service Data Unit (PSDU) payload. Create an HPRF IEEE 802.15.4z lrwpanHRPConfig
object.
psdu = randi([0,1],8*200,1); cfgHPRF = lrwpanHRPConfig(Mode='HPRF', ... Channel=3, ... % Mandatory low-band channel MeanPRF=124.8, ... % 16 chips per payload symbol STSPacketConfiguration=1, ... % Enable STS before payload NumSTSSegments=2, ... % 2 STS segments CodeIndex=27, ... % One 91-symbols long SYNC code PreambleDuration=32, ... % Repetitions for spread SYNC code SFDNumber=1, ... % Choose a 4-symbol long SFD ConstraintLength=7, ... % Convolutional encoder, no RS coding PSDULength=100); % PSDU length in bytes
Generate an HPRF IEEE 802.15.4z waveform by using the lrwpanWaveformGenerator
function and cfgHPRF
configuration object. The waveform generator loops PSDU length as needed to use all input PSDU payload bits. Display the waveform by using a spectrumAnalyzer
object.
waveHPRF = lrwpanWaveformGenerator(psdu,cfgHPRF); sa = spectrumAnalyzer(SampleRate=cfgHPRF.SampleRate); sa(waveHPRF);
Create BPRF IEEE 802.15.4z Waveform
Generate random data for a PHY Service Data Unit (PSDU) payload. Create a BPRF IEEE 802.15.4z lrwpanHRPConfig
object. BPRF payload data rate is always at 6.81 Mbps.
psdu = randi([0,1],8*100,1); cfgBPRF = lrwpanHRPConfig(Mode='BPRF', ... STSPacketConfiguration=0, ... % Turn off STS PHRDataRate=6.81, ... % PSDU header data rate in Mbps CodeIndex=9, ... % A 127-symbols long SYNC code PSDULength=length(psdu)/8); % PSDU length in bytes
Generate an BPRF IEEE 802.15.4z waveform by using the lrwpanWaveformGenerator
function and cfgBPRF
configuration object. The waveform generator loops PSDU length as needed to use all input PSDU payload bits. Display the waveform by using a spectrumAnalyzer
object.
waveBPRF = lrwpanWaveformGenerator(psdu,cfgBPRF); sa = spectrumAnalyzer(SampleRate=cfgBPRF.SampleRate); sa(waveBPRF);
Create IEEE 802.15.4a Waveform
Generate random data for a PHY Service Data Unit (PSDU) payload. Create an IEEE 802.15.4a lrwpanHRPConfig
object.
psdu = randi([0,1],50,1); cfg4a = lrwpanHRPConfig(Mode='802.15.4a', ... Channel=9, ... % High-band mandatory chan for code index 3 MeanPRF=15.6, ... % 8 candidate bursts DataRate=27.24, ... % 1 chip per burst (PHR at 850 kbps max) CodeIndex=3, ... % 3rd code with length 31 PreambleMeanPRF=4.03, ... % PreambleSpreadingFactor = 64 PSDULength=100); % PSDU length in bytes
Generate an 4a IEEE 802.15.4z waveform by using the lrwpanWaveformGenerator
function and cfg4a
configuration object. The waveform generator loops input PSDU payload bits as needed to fill PSDU length. Display the waveform by using a spectrumAnalyzer
object.
wave4a = lrwpanWaveformGenerator(psdu,cfg4a); sa = spectrumAnalyzer(SampleRate=cfg4a.SampleRate); sa(wave4a);
Create Multiframe BPRF IEEE 802.15.4z Waveform
Generate random data for a PHY Service Data Unit (PSDU) payload. Create a BPRF IEEE 802.15.4z lrwpanHRPConfig
object. BPRF payload data rate is always at 6.81 Mbps.
psdu = randi([0,1],8*100,1); cfgBPRF = lrwpanHRPConfig(Mode='BPRF', ... STSPacketConfiguration=0, ... % Turn off STS PHRDataRate=6.81, ... % PSDU header data rate in Mbps CodeIndex=9, ... % A 127-symbols long SYNC code PSDULength=length(psdu)/8); % PSDU length in bytes
Generate a multiframe BPRF IEEE 802.15.4z waveform by using the lrwpanWaveformGenerator
function and cfgBPRF
configuration object. The waveform generator loops PSDU length as needed to use all input PSDU payload bits. Display the waveform by using a timescope
object.
waveBPRF = lrwpanWaveformGenerator(psdu,cfgBPRF, ... NumPackets=3, ... IdleTime=1e-4); ts = timescope(SampleRate=cfgBPRF.SampleRate, ... TimeSpanSource="property", ... TimeSpan=length(waveBPRF)/cfgBPRF.SampleRate, ... YLimits=1.1*[min(waveBPRF), max(waveBPRF)]); ts(waveBPRF);
Input Arguments
data
— Information bits
0
| 1
| binary-valued column vector
Information bits, specified as a binary-valued column vector. Each
transmission packet uses
(cfg
.PSDULength
×8
)
bits from data
. The function loops on
data
as needed to generate the requested number of
packets, NumPackets
. If the number of bits required for
all generated packets exceeds the length of data
, the
data
vector is looped as needed to generate the
requested waveform. Looping on the bits allows you to define a short
pattern, such as [1; 0; 0; 1]
, that repeats as the input
to the PSDU coding across packets.
Data Types: double
| int8
Complex Number Support: Yes
cfg
— Packet format configuration
lrwpanHRPConfig
object | lrwpanOQPSKConfig
object
Packet format configuration, specified as an lrwpanHRPConfig
or lrwpanOQPSKConfig
object. The type of object you specify
determines the IEEE®
802.15.4™ format of the output waveform, wave
. The properties of the packet format configuration
object determine the data rate and PSDU length of generated PPDUs.
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: NumPackets=21,IdleTime=15e-6
NumPackets
— Number of packets
1
(default) | positive integer
Number of packets to generate in a single function call, specified as a positive integer.
IdleTime
— Idle time added after each packet
0
(default) | nonnegative scalar
Idle time added after each packet in seconds, specified as a nonnegative scalar.
Output Arguments
wave
— Packetized waveform
column vector
Packetized waveform, returned as a column vector.
wave
contains one or more packets of the same PPDU
format. Each packet can contain different information bits. For more
information, see IEEE 802.15.4 PPDU Format.
Data Types: double
Complex Number Support: Yes
symbols
— HRP signal before pulse shaping
column vector of ternary values
HRP signal before pulse shaping, returned as a column vector of ternary
values, specifically [-1
, 0
,
1
]. symbols
contains the
modulated (symbol mapped) signal after preamble insertion.
Dependencies
This output applies when the input configuration object, cfg
, is an lrwpanHRPConfig
object.
Data Types: double
Complex Number Support: Yes
More About
IEEE 802.15.4 PPDU Format
The IEEE standards for low-rate wireless networks, [1] and [2], specify IEEE 802.15.4 PHY protocol data unit (PPDU) formats for transmission of O-QPSK PHY and HRP UWB PHY waveforms. For all formats, the PPDU field structure includes preamble and payload portions. This figure shows the PPDU headers and payloads as defined in Figure 5-7 of [1].
The
lrwpanHRPConfig
object specifies configuration for the HRP UWB PPDU format — The output waveform is a high-rate pulse repetition frequency (HRP) ultra-wide band (UWB) IEEE 802.15.4 a/z waveform. If theMode
property of the object is:'HPRF'
— The output is a higher pulse repetition frequency (HPRF) waveform.'BPRF'
— The output is a base pulse repetition frequency (BPRF) waveform.'802.15.4a'
— The output is an IEEE 802.15.4a™ waveform.
The
lrwpanOQPSKConfig
object specifies configuration for the O-QPSK PPDU format — The output waveform is a ZigBee® O-QPSK IEEE 802.15.4 waveform.
Waveform Looping
To produce a continuous input stream, you can have your code loop on a waveform from the last packet back to the first packet.
When looping a waveform, the last symbol of packet_N is followed by the first symbol of packet_1. If the waveform has only one packet, the waveform loops from the last symbol of the packet to the first symbol of the same packet.
Specify the idle time by using the IdleTime
input to the lrwpanWaveformGenerator
function.
References
[1] IEEE STD 802.15.4-2020. "IEEE Standard for Low-Rate Wireless Networks." May 2020.
[2] IEEE STD 802.15.4z-2020. "IEEE Standard for Low-Rate Wireless Networks." Amendment 1: Enhanced Ultra Wideband (UWB) Physical Layers (PHYs) and Associated Ranging Techniques. June 2020.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2023aR2023b: lrwpanWaveformGenerator
moved into Communications Toolbox
Communications Toolbox™ Library for ZigBee and UWB add-on features are now accessed from your Communications Toolbox software. In previous releases you needed to download the Communications Toolbox Library for ZigBee and UWB add-on to use lrwpanWaveformGenerator
.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)