Matlab generates wlan 802.11ac waveform code description: wlanWaveformGenerator function and wlanVHTConfig function function description

Matlab generates wlan 802.11ac waveform code and function description

1. wlanWaveformGenerator function

The wlanWaveformGenerator function is used to generate WLAN waveforms and has the following parameters and formats:

txWaveform = wlanWaveformGenerator(txPSDU, cfg)
txWaveform = wlanWaveformGenerator(txPSDU, cfg, scramInit, payloadIdx)
txWaveform = wlanWaveformGenerator(txPSDU, cfg, scramInit, payloadIdx, crcGen, scramSeed)

The parameters are described as follows:

parameter illustrate
txPSDU The data to be transmitted (Payload Service Data Unit). It is a column vector containing binary data of 0 and 1. Its length must be 8 times cfg.PSDULength. For example, for 802.11ac, the default value of cfg.PSDULength is 1000 bytes, so the length of txPSDU should be 8000.
cfg WLAN configuration object, used to specify WLAN standards and related parameters. You can use the wlanVHTConfig function to create a default 802.11ac configuration object and then modify it as needed.
scramInit (optional) Scrambled initial state. It is an integer value that specifies the initial state of the scrambler. The default value is 0.
payloadIdx (optional) load index. It is a non-negative integer specifying the current load index among multiple loads. The default value is 0.
crcGen (optional) CRC (Cyclic Redundancy Check) generator polynomial. It is a row vector specifying the coefficients of the CRC generator polynomial. By default, a polynomial corresponding to the WLAN standard is used.
scramSeed (optional) Scrambled seeds. It is a non-negative integer specifying the seed value for the scrambler. The default value is 0. The function returns a column vector txWaveform representing the generated WLAN waveform.

To learn more about the use and configuration of each parameter, please refer to the documentation of MATLAB and the related documentation of WLAN System Toolbox.

2. wlanVHTConfig function

The wlanVHTConfig function is used to create an 802.11ac WLAN configuration object and has the following parameters:

cfg = wlanVHTConfig
cfg = wlanVHTConfig(Name,Value)

The parameters are described as follows:

parameter illustrate
ChannelBandwidth channel bandwidth. Possible values ​​are 'CBW20', 'CBW40', 'CBW80' or 'CBW160'. The default value is 'CBW80'.
NumUsers amount of users
UserPositions user location
MCS Modulation and Coding Scheme (Modulation and Coding Scheme) under multi-user conditions. Optional values ​​are integers between 0 and 9. The default value is 0.
ChannelCoding signal coding
PSDULength The number of bytes to encode in the packet
GuardInterval guard interval. Possible values ​​are 'Long' or 'Short'. The default value is 'Long'.
NumTransmitAntennas Number of transmit antennas. Possible values ​​are 1 or 2. The default value is 1.
NumSpaceTimeStreams The number of space-time streams. Possible values ​​are 1 or 2. The default value is 1.
SpatialMapping The spatial mapping method. Possible values ​​are 'Direct', 'Hadamard', or 'Fourier'. The default value is 'Direct'.
GroupID Group identifier. Possible values ​​are 0 or 1. The default value is 0.
STBC Space-Time Block Coding. A logical value indicating whether to use STBC. The default value is false.
APEPLength The payload length of the packet. A positive integer representing the length in bytes. The default value is 1000.
NumPackets The number of packets in the generated waveform. A positive integer representing the number of packets to generate. The default value is 1.
Return The function returns a WLAN configuration object cfg, which contains the specified parameter values.

To learn more about the use and configuration of each parameter, please refer to the documentation of MATLAB and the related documentation of WLAN System Toolbox.

3. Sample code

% 设置参数
cfg = wlanVHTConfig(); % 默认802.11ac配置
cfg.ChannelBandwidth = 'CBW40'; % 信道带宽
cfg.NumTransmitAntennas = 2; % 发射天线数量
cfg.NumSpaceTimeStreams = 2; % 空时流数量

% 生成随机数据
txData = randi([0 1], 8*cfg.PSDULength, 1); % 生成8倍PSDU长度的随机数据

% 生成波形
txWaveform = wlanWaveformGenerator(txData, cfg);

% 添加高斯噪声
snr = 20; % 信噪比(dB)
rxWaveform = awgn(txWaveform, snr, 'measured');

% 显示波形
figure;
plot(abs(txWaveform));
title('Transmitted Waveform');
xlabel('Sample Index');
ylabel('Magnitude');

figure;
plot(abs(rxWaveform));
title('Received Waveform');
xlabel('Sample Index');
ylabel('Magnitude');

insert image description here

appendix

MCS meaning

Each MCS value represents a specific Modulation and Coding Scheme (Modulation and Coding Scheme) for transmitting data in a wireless local area network (WLAN) system. Different MCS values ​​provide different data transfer rates and reliability.

Specifically, in the IEEE 802.11 WLAN standard, each MCS value corresponds to a set of modulation, coding and data transmission rates. In general, lower MCS values ​​provide lower data transfer rates but better reliability, while higher MCS values ​​provide higher data transfer rates but poorer reliability.

For different WLAN standards (such as 802.11a/g/n/ac/ax), the range of MCS value and the corresponding rate may be different.
insert image description here
Note that exact rates and performance depend on other factors such as channel bandwidth, antenna configuration, signal quality, and interference conditions.

Guess you like

Origin blog.csdn.net/weixin_45248370/article/details/130846512