%% Recover L-SIG Information Bits with Channel State Information
% Recover the information bits in the L-SIG field of a WLAN HE multiuser (HE-MU) waveform with specified channel state information.
% Create a WLAN HE-MU-format configuration object with an allocation index of 192 and use it to generate an HE-MU waveform.

cfgHE = wlanHEMUConfig(192);
cbw = cfgHE.ChannelBandwidth;
waveform = wlanWaveformGenerator(1,cfgHE);

% Obtain the WLAN field indices, which contain the modulated L-SIG and RL-SIG fields.

ind = wlanFieldIndices(cfgHE);
rxLSIG = waveform(ind.LSIG(1):ind.RLSIG(2),:);

% Perform OFDM demodulation to extract the L-SIG field.

lsigDemod = wlanHEDemodulate(rxLSIG,'L-SIG',cbw);

% Average the L-SIG and RL-SIG symbols, return the pre-HE OFDM information, and extract the demodulated L-SIG symbols.

lsigDemodAverage = mean(lsigDemod,2);
preHEInfo = wlanHEOFDMInfo('L-SIG',cbw);
lsig = lsigDemodAverage(preHEInfo.DataIndices,:);

% Specify the channel state information and assume no channel noise.

csi = ones(52,1);
noiseVarEst = 0;

% Recover the L-SIG information bits and other information. Display the parity check result.

[bits,failCheck,info] = wlanLSIGBitRecover(lsig,noiseVarEst,csi);
disp(failCheck);

% Copyright 2018 The MathWorks, Inc.