%% Estimate Channel with L-LTF and Recover VHT-SIG-A
% Create a VHT format configuration object. Generate L-LTF and VHT-SIG-A fields.

vht = wlanVHTConfig;
txLLTF = wlanLLTF(vht);
txSig = wlanVHTSIGA(vht);

%
% Create a TGac channel for an 80 MHz bandwidth and a Model-A delay profile. Pass the transmitted L-LTF and VHT-SIG-A signals through the channel.

tgacChan = wlanTGacChannel('SampleRate',80e6,'ChannelBandwidth','CBW80', ...
    'DelayProfile','Model-A');

rxLLTFNoNoise = tgacChan(txLLTF);
rxSigNoNoise = tgacChan(txSig);

%
% Create an AWGN noise channel with an SNR = 15 dB. Add the AWGN noise to L-LTF and VHT-SIG-A signals.

chNoise = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)', ...
    'SNR',15);

rxLLTF = chNoise(rxLLTFNoNoise);
rxSig = chNoise(rxSigNoNoise);

%
% Create an AWGN channel having a noise variance corresponding to a 9 dB noise figure receiver. Pass the faded signals through the AWGN channel.

nVar = 10^((-228.6 + 10*log10(290) + 10*log10(80e6) + 9)/10);
awgnChan = comm.AWGNChannel('NoiseMethod','Variance','Variance',nVar);

rxLLTF = awgnChan(rxLLTF);
rxSig = awgnChan(rxSig);

%
% Demodulate the received L-LTF.

demodLLTF = wlanLLTFDemodulate(rxLLTF,vht);

%
% Estimate the channel using the demodulated L-LTF.

chEst = wlanLLTFChannelEstimate(demodLLTF,vht);

%
% Recover the VHT-SIG-A signal and verify that there was no CRC failure.

[recBits,crcFail] = wlanVHTSIGARecover(rxSig,chEst,nVar,'CBW80');
crcFail

% Copyright 2012 The MathWorks, Inc.