%% Recover HT-Data Bits
% Create an HT configuration object having a PSDU length of 1024 bytes. Generate an HTData sequence from a binary sequence whose length is eight times the length of the PSDU.

cfgHT = wlanHTConfig('PSDULength',1024);
txBits = randi([0 1],8*cfgHT.PSDULength,1);
txHTSig = wlanHTData(txBits,cfgHT);

%
% Pass the signal through an AWGN channel with a signal-to-noise ratio of 10 dB.

rxHTSig = awgn(txHTSig,10);

%
% Specify a channel estimate. Because fading was not introduced, a vector of ones is a perfect estimate. For a 20 MHz bandwidth, there are 52 data subcarriers and 4 pilot subcarriers in the HT-SIG field.

chEst = ones(56,1);

%
% Recover the data bits and determine the number of bit errors. Display the number of bit errors and the associated bit error rate.

rxBits = wlanHTDataRecover(rxHTSig,chEst,0.1,cfgHT);
[numerr,ber] = biterr(rxBits,txBits)

% Copyright 2012 The MathWorks, Inc.