%% Build Non-HT PPDU
% Build non-HT PPDUs by using the waveform generator function or by building each field individually.
%% Waveform Generator
% Create a non-HT configuration object.

nht = wlanNonHTConfig;

%
% Generate the non-HT PPDU. The length of the input data sequence in bits must be 8 times the length of the PSDU, which is expressed in bytes. Turn off windowing.

x = randi([0 1],nht.PSDULength*8,1);
y = wlanWaveformGenerator(x,nht,'WindowTransitionTime',0);

%
% Plot the magnitude of the waveform.

t = ((1:length(y))'-1)/20e6;
plot(t,abs(y))
xlabel('Time (s)')
ylabel('Magnitude (V)')

%
%% Individual PPDU Fields
% Create L-STF, L-LTF, and L-SIG preamble fields.

lstf = wlanLSTF(nht);
lltf = wlanLLTF(nht);
lsig = wlanLSIG(nht);

%
% Generate the Non-HT-data field using input data field x, which was used as the input to the waveform generator.

nhtData = wlanNonHTData(x,nht);

%
% Concatenate the individual fields to create a single PPDU.

z = [lstf; lltf; lsig; nhtData];

%
% Verify that the PPDUs created by the two methods are identical.

isequal(y,z)

% Copyright 2012 The MathWorks, Inc.