%% Generate VHT Waveform with Random Scrambler State
% Generate a time-domain signal for an 802.11ac VHT transmission with five packets and a 30-microsecond idle period between packets. Use a random scrambler initial state for each packet.
% Create a VHT configuration object and confirm the channel bandwidth for scaling the x-axis of the plot.

cfg = wlanVHTConfig;
disp(cfg.ChannelBandwidth)

%
% Generate and plot the waveform. Display the time in microseconds on the x-axis.

numPkts = 5;
bits = [1;0;0;1];
scramInit = randi([1 127],numPkts,1);
txWaveform = wlanWaveformGenerator(bits,cfg,'NumPackets',numPkts,'IdleTime',30e-6,'ScramblerInitialization',scramInit);
time = [0:length(txWaveform)-1]/80e-6;
plot(time,abs(txWaveform));
title('Five Packets Separated by 30-Microsecond Idle Periods');
xlabel ('Time (microseconds)');
ylabel('Amplitude');

% Copyright 2012 The MathWorks, Inc.