%% Filter 802.11ad Waveform Through TGay Channel
% Filter an 802.11ad™ single-carrier unpolarized waveform through an SU-SISO 802.11ay™ channel, specifying a large hotel lobby environment. Check that the output signal is consistent when the same input waveform is filtered through the channel.
% Create a directional-multi-gigabit-format (DMG-format) configuration object with the specified modulation and coding scheme (MCS).

cfgDMG = wlanDMGConfig('MCS','4');

% Generate a DMG waveform for a randomly generated PSDU.

psdu = randi([0 1], 8*cfgDMG.PSDULength, 1);
txWaveform = wlanWaveformGenerator(psdu,cfgDMG);

% Configure a TGay channel System object for a large hotel lobby environment, specifying the sample rate, transmit and receive antenna arrays, and source of the random number stream.

tgay =  wlanTGayChannel('SampleRate',wlanSampleRate(cfgDMG),'Environment','Large hotel lobby', ... 
    'TransmitArray',wlanURAConfig('Size',[4 4]),'ReceiveArray',wlanURAConfig('Size',[3 3]), ...
    'RandomStream','mt19937ar with seed','Seed',100);

% Filter the waveform through the TGay channel.

rxWaveform1 = tgay(txWaveform);

% Reset the channel and filter the waveform through the TGay channel again. Check that the output waveform is consistent when the same input waveform is filtered through the TGay channel after calling the reset object function.

reset(tgay);
rxWaveform2 =  tgay(txWaveform);
isequal(rxWaveform1,rxWaveform2)

% Copyright 2018 The MathWorks, Inc.