%% Generate WLAN Packet Decision Statistics
% Return the decision statistics of a WLAN waveform that consists of five 802.11a packets.
% Create a non-HT configuration object and a five-packet waveform. Delay the waveform by 4000 samples.

cfgNonHT = wlanNonHTConfig;
txWaveform = wlanWaveformGenerator([1;0;0;1],cfgNonHT, ...
    'NumPackets',5,'IdleTime',20e-6);

rxWaveform = [zeros(4000,1);txWaveform];

%
% Setting the threshold input to 1, generates packet decision statistics for the entire waveform and suppresses the startOffset output. Plot the decision statistics, M.

offset = 0;
threshold = 1;
[startOffset,M] = wlanPacketDetect(rxWaveform,cfgNonHT.ChannelBandwidth,...
    offset,threshold);
plot(M)

%
% Since threshold = 1, the decision statistics for the entire waveform are included in the output M. The decision statistics show five peaks. The peaks corresponds to the first sample of each packet detected. View startOffset.

startOffset

% The returned startOffset is empty because threshold was set to 1.
% Copyright 2012 The MathWorks, Inc.