%% Recover L-SIG Field from Phase and Frequency Offset
% Recover the L-SIG field rom a channel that introduces a fixed phase and frequency offset.
% Create a VHT configuration object corresponding to a 160 MHz SISO channel. Generate the transmitted L-SIG field.

cfgVHT = wlanVHTConfig('ChannelBandwidth','CBW160');
txLSIG = wlanLSIG(cfgVHT);

% To introduce a 45 degree phase offset and a 100 Hz frequency offset, create a phase and frequency offset System object.

pfOffset = comm.PhaseFrequencyOffset('SampleRate',160e6,'PhaseOffset',45, ...
    'FrequencyOffset',100);

% Introduce phase and frequency offsets to the transmitted L-SIG field, then pass it through an AWGN channel.

rxSIG = awgn(pfOffset(txLSIG),20);

% Recover the L-SIG information bits, the failure check status, and the equalized symbols, disabling pilot phase tracking.

chEst = ones(416,1);
noiseVarEst = 0.01;
[recBits,failCheck,eqSym] = wlanLSIGRecover(rxSIG,chEst,noiseVarEst,'CBW160','PilotPhaseTracking','None');

% Verify that the L-SIG passed the failure checks.

disp(failCheck)

% Visualize the phase offset by plotting the equalized symbols.

scatterplot(eqSym)
grid

% Copyright 2012 The MathWorks, Inc.