%% L-LTF Channel Estimation After TGn Channel
% Generate a time domain waveform for an 802.11n HT packet, pass it through a TGn fading channel and perform L-LTF channel estimation. Trailing zeros are added to the waveform to allow for TGn channel delay.
% Create the HT packet configuration and transmit waveform.

cfgHT = wlanHTConfig;
txWaveform = wlanWaveformGenerator([1;0;0;1],cfgHT);

%
% Configure a TGn channel with 20 MHz bandwidth.

tgnChannel = wlanTGnChannel;
tgnChannel.SampleRate = 20e6;

%
% Pass the waveform through the TGn channel, adding trailing zeros to allow for channel delay.

rxWaveform = tgnChannel([txWaveform; zeros(15,1)]);

%
% Skip the first four samples to synchronize the received waveform for channel delay.

rxWaveform = rxWaveform(5:end,:);

%
% Extract the L-LTF and perform channel estimation.

idnLLTF = wlanFieldIndices(cfgHT,'L-LTF');
sym = wlanLLTFDemodulate(rxWaveform(idnLLTF(1):idnLLTF(2),:),cfgHT);
est = wlanLLTFChannelEstimate(sym,cfgHT);

% Copyright 2012 The MathWorks, Inc.