%% Pass S1G Waveform Through TGah Channel
% Filter an 802.11ah waveform through a TGah channel.

cfgS1G = wlanS1GConfig;
txWaveform = wlanWaveformGenerator([1;0;0;1],cfgS1G);
%% 
% Create a TGah channel object and adjust some default properties. Specify 
% a seed value to produce a repeatable channel output. Create an S1G configuration 
% object and waveform. Pass the S1G waveform through the channel by supplying 
% it as an input to the TGah channel object.
%%
tgah = wlanTGahChannel;
tgah.LargeScaleFadingEffect = 'PathLoss and shadowing';
tgah.FloorSeparation = 2;
tgah.RandomStream = 'mt19937ar with seed';
tgah.Seed = 10;

channelOutput = tgah(txWaveform);
%% 
% Confirm the channel bandwidth and set the corresponding sample rate.
%%
cfgS1G.ChannelBandwidth
fs = 2e6;
%% 
% Plot the spectrum of the channel output waveform.
%%
saScope = dsp.SpectrumAnalyzer('SampleRate',fs,'YLimits',[-110 -30]);
saScope(channelOutput)
%% 
% Across the spectrum, the mean power of the channel output waveform is 
% approximately -50 dBm.