Main Content

wlanSpectralFlatness

Test spectral flatness

Since R2022a

Description

pass = wlanSpectralFlatness(chanEst,format,cbw) tests spectral flatness by using the channel estimate chanEst for the specified WLAN packet format format and channel bandwidth cbw. The function determines the test result by comparing the spectral flatness measurements to the standard-specified range.

pass = wlanSpectralFlatness(chanEst,format,cbw,preamblePunc) tests spectral flatness by using the channel estimate chanEst for the specified non-high-throughput (non-HT) packet, along with the specified channel bandwidth cbw and the preamble puncturing flag preamblePunc. The function determines the test result by comparing the spectral flatness measurements to the standard-specified range. (since R2025a)

pass = wlanSpectralFlatness(chanEst,format,cbw,ruIndices) tests spectral flatness by using the channel estimate chanEst for the specified high efficiency (HE) packet, along with the specified channel bandwidth cbw and resource unit (RU) indices ruIndices. The function determines the test result by comparing the spectral flatness measurements to the standard-specified range.

example

pass = wlanSpectralFlatness(chanEst,format,cbw,ruIndices,ruSizes) tests spectral flatness by using the channel estimate chanEst for the specified extremely high-throughput (EHT) packet, along with the specified channel bandwidth cbw, the resource unit (RU) indices ruIndices, and the RU sizes of each RU or multiresource unit (MRU) ruSizes. The function determines the test result by comparing the spectral flatness measurements to the standard-specified range. (since R2025a)

pass = wlanSpectralFlatness(chanEst,format,cbw,ruIndices,ruSizes,preamblePunc) tests spectral flatness by using the channel estimate chanEst for an extremely high-throughput (EHT) packet, along with the specified channel bandwidth cbw, the resource unit (RU) indices ruIndices, the RU sizes of each RU or MRU ruSizes, and the preamble puncturing flag preamblePunc. The function determines the test result by comparing the spectral flatness measurements to the standard-specified range. (since R2025a)

[pass,deviation,testSC] = wlanSpectralFlatness(chanEst,format,cbw) also returns the power deviation of each test subcarrier from the average power level across lower test subcarriers, deviation. The function splits the test subcarrier indices into upper and lower sets based on their absolute frequency and returns these indices as testSC.

example

Examples

collapse all

Configure and generate a very high throughput (VHT) waveform.

cfgVHT = wlanVHTConfig;
bits = [1; 0; 0; 1];
waveform = wlanWaveformGenerator(bits,cfgVHT);

Demodulate the VHT long training field (VHT-LTF).

field = "VHT-LTF";
ind = wlanFieldIndices(cfgVHT,field);
sym = wlanVHTLTFDemodulate(waveform(ind(1):ind(2),:),cfgVHT);

Perform channel estimation on the demodulated signal.

chanEst = wlanVHTLTFChannelEstimate(sym,cfgVHT);

Test the spectral flatness of the transmission, specifying the channel bandwidth and packet format, and display the result.

format = "VHT";
cbw = cfgVHT.ChannelBandwidth;
[pass,deviation,testSC] = wlanSpectralFlatness(chanEst,format,cbw);
disp(pass)
   1

Test spectral flatness using channel estimates for a high-efficiency (HE) transmission with a channel bandwidth of 40 MHz.

Create a configuration object for the HE multi-user (HE MU) packet format.

cfgHEMU = wlanHEMUConfig([1 0]);

Generate a waveform using the packet configuration.

txWaveform = wlanWaveformGenerator([1; 0; 0; 1],cfgHEMU);

Specify the received waveform, assuming that the received waveform is the same as the transmitted waveform.

rxWaveform = txWaveform; % Received waveform

Identify the indices of the HE long training Field (HE-LTF) in the waveform.

indicesHELTF = wlanFieldIndices(cfgHEMU,"HE-LTF");

Identify the resource unit (RU) indices using allocation information.

allocationInfo = ruInfo(cfgHEMU);
ruIndices = allocationInfo.RUIndices;

Predefine a cell array to store the channel estimates.

chanEst = cell(allocationInfo.NumRUs,1);

Iterate over each RU and perform these steps:

  • Extract the received waveform corresponding to the HE-LTF for the current RU.

  • Add additive white Gaussian noise (AWGN) to the extracted received waveform.

  • Demodulate the HE-LTF using the wlanHEDemodulate function.

  • Estimate the channel response for the RU of interest using the wlanHELTFChannelEstimate function.

  • Store the channel estimate in the cell array.

for ruIndex = 1:allocationInfo.NumRUs
    rxHETLF = rxWaveform(indicesHELTF(1): indicesHELTF(2),:);
    rxHETLF = awgn(rxHETLF, 20);
    demodHELTF = wlanHEDemodulate(rxHETLF,"HE-LTF",cfgHEMU,ruIndex);
    chanEst{ruIndex,1} = wlanHELTFChannelEstimate(demodHELTF,cfgHEMU,ruIndex);
end

Test the spectral flatness.

pass = wlanSpectralFlatness(chanEst,"HE","CBW40",ruIndices);

Input Arguments

collapse all

Channel estimates for data and pilot subcarriers, specified as one of these options.

  • For transmissions that have a single RU, specify chanEst as a complex-valued 3-D array of size Nst-by-Nsts-by-Nr.

    • Nst is the number of occupied subcarriers.

    • Nsts is the number of space-time streams.

    • Nr is the number of receive antennas.

  • For transmissions that have multiple RUs , specify chanEst as a complex-valued cell array. Each cell contains an Nst-by-Nsts-by-Nr array.

    Each cell array supports these RUs for orthogonal frequency-division multiple access (OFDMA), mixed OFDMA, and multiuser multiple-input multiple-output (MU-MIMO) waveforms for the WLAN packet formats "HE" and "EHT" .

    RUChannel Bandwidth (cbw)
    26-tone"CBW20","CBW40","CBW80", "CBW160", and "CBW320"
    52-tone"CBW20","CBW40","CBW80", and "CBW160", and "CBW320"
    106-tone"CBW20","CBW40","CBW80", "CBW160", and "CBW320"
    242-tone"CBW40","CBW80", "CBW160", and "CBW320"
    484-tone"CBW80", "CBW160", and "CBW320"
    996-tone"CBW160" and "CBW320"
    2×996-tone"CBW320"

    Note that the EHT format is the only one that supports the "CBW320" bandwidth. To obtain reliable results when testing the spectral flatness of an OFDMA transmission, you must provide channel estimates corresponding to all active subcarrier indices within the specified channel bandwidth to obtain reliable spectral flatness test results. If you do not supply averaging subcarrier indices as input, the wlanSpectralFlatness function returns a pass verdict of false. For additional information, see Table 27-26 of IEEE® standard 802.11ax™ [2] and Table 36-34 of IEEE standard 802.11 be™ [1].

    Note

    Because this function assumes a wired link between each transmit and receive antenna, use only the appropriate channel estimates.

Data Types: single | double
Complex Number Support: Yes

WLAN packet format, specified as a string scalar or character vector corresponding to these IEEE packet formats and 802.11™ standards.

ValueFormatStandard
"EHT" Extremely high throughput (EHT)IEEE P802.11be™/D1.2 [1]
"HE"High-efficiency single-user (HE SU), HE extended-range single-user (HE ER SU), HE multi-user (HE MU), or HE trigger-based (HE TB)IEEE Std 802.11ax-2021 [2]
"VHT"Very high throughput (VHT)IEEE Std 802.11-2020 [3]
"HT"High throughput (HT)
"Non-HT"Non-high-throughput (non-HT)
"S1G"Sub 1 GHz (S1G)

Data Types: char | string

Channel bandwidth, specified as one of these values.

  • "CBW1" — Channel bandwidth of 1 MHz

  • "CBW2" — Channel bandwidth of 2 MHz

  • "CBW4" — Channel bandwidth of 4 MHz

  • "CBW5" — Channel bandwidth of 5 MHz

  • "CBW8" — Channel bandwidth of 8 MHz

  • "CBW10" — Channel bandwidth of 10 MHz

  • "CBW16" — Channel bandwidth of 16 MHz

  • "CBW20" — Channel bandwidth of 20 MHz

  • "CBW40" — Channel bandwidth of 40 MHz

  • "CBW80" — Channel bandwidth of 80 MHz

  • "CBW160" — Channel bandwidth of 160 MHz

  • "CBW320" — Channel bandwidth of 320 MHz

Valid values of this input depend on the value of the format input according to this table.

Value of formatValid Values of cbw
"EHT""CBW20", "CBW40", "CBW80", "CBW160", "CBW320"
"HE""CBW20", "CBW40", "CBW80", "CBW160"
"VHT""CBW20", "CBW40", "CBW80", "CBW160"
"HT""CBW20", "CBW40"
"Non-HT""CBW5", "CBW10", "CBW20", "CBW40", "CBW80", "CBW160"
"S1G""CBW1", "CBW2", "CBW4", "CBW8", "CBW16"

Data Types: char | string

RU index, specified as one of these options.

  • A scalar or vector for the HE format — Each element specifies the location of an RU within the channel.

    For example, A 20 MHz transmission contains nine 26-tone RUs with an allocation index of 0. RU 26-1 (with a size of 26 and an index of 1) is the lowest frequency occupied by a RU within the 20 MHz channel bandwidth, and RU 26-9 (with a size of 26 and an index of 9) is the highest frequency occupied by a RU. In this case, specify ruIndices as [1 2 3 4 5 6 7 8 9].

    You can specify ruIndices as a scalar when puncturing a 20 MHz subchannel. To specify the ruIndices argument, chanEst must be a cell array and the WLAN packet format must be of type "HE".

  • Scalar cell or a cell array for the EHT format — Contains the index of each RU or Multi-RU (MRU). The RU index specifies the location of the RU or MRU within the channel. For example, in a 20 MHz transmission, the allocation index 49 includes a 106+26 MRU, a 52+26 MRU, and a 26 RU. Then, specify ruIndices as {[1 5], [3 8], 9}. For more information about this allocation, see EHT MU Transmission.

    For non-OFDMA waveforms and OFDMA waveforms with a single RU, ruIndices is a scalar cell. For OFDMA waveforms with multiple RUs, ruIndices is a cell array.

Since R2025a

Sizes of each RU or MRU, specified as a scalar cell or a cell array. For example, in a 20 MHz transmission, the allocation index 49 includes a 106+26 MRU, a 52+26 MRU, and a 26 RU. For such a transmission, ruSizes is {[106 26], [52 26], 26}.

For non-OFDMA waveforms and OFDMA waveforms with a single RU, ruSizes is a scalar cell. For OFDMA waveforms with multiple RUs, ruSizes is a cell array.

Since R2025a

Preamble puncturing indicator, specified as true (logical 1) or false (logical 0).

Output Arguments

collapse all

Spectral flatness test result, returned as 1 or 0. If the measured spectral flatness falls within the standard-specified range, the received signal passes the test and the function returns this output as 1. Otherwise, the function returns this output as 0.

Data Types: logical

Power deviation of each test subcarrier from the average power level across lower test subcarriers, returned as a 1-by-2 cell array of real-valued matrices.

The first entry contains the power deviations per antenna across the lower test subcarriers in a matrix of size Nlsc-by-Nr, where Nlsc is the number of lower test subcarriers and Nr is the number of receive antennas.

The second entry contains the power deviations per antenna across the upper test subcarriers in a matrix of size Nusc-by-Nr, where Nusc is the number of upper test subcarriers.

Data Types: cell

Test subcarrier indices, returned as a 1-by-2 cell array of real-valued column vectors.

The first element contains the lower test subcarrier indices in a vector of length equal to the number of lower test subcarriers.

The second element contains the upper test subcarrier indices in a vector of length equal to the number of upper test subcarriers.

Data Types: cell

References

[1] IEEE P802.11be/D1.2. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 8: Enhancements for Extremely High Throughput (EHT).” Draft Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.

[2] IEEE Std 802.11ax-2021 (Amendment to IEEE Std 802.11-2020). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 1: Enhancements for High Efficiency WLAN.” IEEE Standard for Information Technology — Telecommunications and Information Exchange between Systems. Local and Metropolitan Area Networks — Specific Requirements.

[3] IEEE Std 802.11-2020 (Revision of IEEE Std 802.11-2016). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.” IEEE Standard for Information Technology — Telecommunications and Information Exchange between Systems — Local and Metropolitan Area Networks — Specific Requirements.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2022a

expand all