%% Transmit HT Waveform Through TGn Channel
% Generate an HT waveform and pass it through a TGn SISO channel. Display the 
% spectrum of the resultant signal.
% 
% Set the channel bandwidth and the corresponding sample rate.

bw = 'CBW40';
fs = 40e6;
%% 
% Generate an HT waveform for a 40 MHz channel.
%%
cfg = wlanHTConfig('ChannelBandwidth',bw);
txSig = wlanWaveformGenerator(randi([0 1],1000,1),cfg);
%% 
% Create a TGn SISO channel with path loss and shadowing enabled.
%%
tgnChan = wlanTGnChannel('SampleRate',fs, ...
    'LargeScaleFadingEffect','Pathloss and shadowing');
%% 
% Pass the HT waveform through the channel. 
%%
rxSig = tgnChan(txSig);
%% 
% Plot the spectrum of the received waveform. 
%%
saScope = dsp.SpectrumAnalyzer('SampleRate',fs,'YLimits',[-120 -40]);
saScope(rxSig)
%% 
% Because path loss and shadowing are enabled, the mean received power across 
% the spectrum is approximately -60 dBm.