%% Recover VHT-SIG-A in 2x2 MIMO Channel
% Recover VHT-SIG-A in a 2x2 MIMO channel with AWGN. Confirm that the CRC check passes.
% Configure a 2x2 MIMO VHT channel.

chanBW = 'CBW20';
cfgVHT = wlanVHTConfig('ChannelBandwidth', chanBW, 'NumTransmitAntennas', 2, 'NumSpaceTimeStreams', 2);

%
% Generate L-LTF and VHT-SIG-A waveforms.

txLLTF  = wlanLLTF(cfgVHT);
txVHTSIGA = wlanVHTSIGA(cfgVHT);

%
% Pass the L-LTF and VHT-SIG-A waveforms through a 2×2 MIMO channel with white noise.

mimoChan = comm.MIMOChannel('SampleRate', 20e6);
rxLLTF = awgn(mimoChan(txLLTF), 15);
rxVHTSIGA = awgn(mimoChan(txVHTSIGA),15);

%
% Demodulate the L-LTF signal. To generate a channel estimate, use the demodulated L-LTF.

demodLLTF = wlanLLTFDemodulate(rxLLTF, chanBW, 1);
chanEst = wlanLLTFChannelEstimate(demodLLTF, chanBW);

%
% Recover the information bits in VHT-SIG-A.

[recVHTSIGABits, failCRC, eqSym] = wlanVHTSIGARecover(rxVHTSIGA, chanEst, 0, chanBW);

%
% Visualize the scatter plot of the equalized symbols, eqSym.

scatterplot(eqSym(:))

% Copyright 2012 The MathWorks, Inc.