Main Content

Generate VHT Multi-User Waveform

This example shows how to generate a VHT multi-user waveform from individual components. It also shows how to generate the same waveform by using the wlanWaveformGenerator function.

Create a VHT configuration object, specifying three users and three transmit antennas.

vht = wlanVHTConfig('NumUsers',3,'NumTransmitAntennas',3);

Set the number of space-time streams to the vector [1 1 1], which indicates that each user is assigned one space-time stream. Set the user positions to [0 1 2]. Set the group ID to 5. Group ID values from 1 to 62 apply for multiuser operation.

vht.NumSpaceTimeStreams = [1 1 1];
vht.UserPositions = [0 1 2];
vht.GroupID = 5;

Set a different MCS value for each user.

vht.MCS = [0 2 4];

Set the APEP length to 2000, 1400, and 1800 bytes. Each element corresponds to the number of bytes assigned to each user.

vht.APEPLength = [2000 1400 1800]
vht = 
  wlanVHTConfig with properties:

       ChannelBandwidth: 'CBW80'
               NumUsers: 3
          UserPositions: [0 1 2]
    NumTransmitAntennas: 3
    NumSpaceTimeStreams: [1 1 1]
         SpatialMapping: 'Direct'
                    MCS: [0 2 4]
          ChannelCoding: 'BCC'
             APEPLength: [2000 1400 1800]
          GuardInterval: 'Long'
                GroupID: 5

   Read-only properties:
             PSDULength: [2000 6008 12019]

Display the PSDU lengths for the three users. The PSDU length is a function of both the APEP length and the MCS value.

vht.PSDULength
ans = 1×3

        2000        6008       12019

Display the field indices for the VHT waveform.

ind = wlanFieldIndices(vht)
ind = struct with fields:
       LSTF: [1 640]
       LLTF: [641 1280]
       LSIG: [1281 1600]
    VHTSIGA: [1601 2240]
     VHTSTF: [2241 2560]
     VHTLTF: [2561 3840]
    VHTSIGB: [3841 4160]
    VHTData: [4161 48000]

Create the individual fields that comprise the VHT waveform.

lstf = wlanLSTF(vht);
lltf = wlanLLTF(vht);
lsig = wlanLSIG(vht);
[vhtsigA,sigAbits] = wlanVHTSIGA(vht);
vhtstf = wlanVHTSTF(vht);
vhtltf = wlanVHTLTF(vht);
[vhtsigB,sigBbits] = wlanVHTSIGB(vht);

Extract the first two VHT-SIG-A information bits and convert them to their decimal equivalent.

bw = bi2de(double(sigAbits(1:2)'))
bw = 2

The value, 2, corresponds to an 80 MHz bandwidth (see wlanVHTSIGA).

Extract VHT-SIG-A information bits 5 through 10, and convert them to their decimal equivalent.

groupid = bi2de(double(sigAbits(5:10)'))
groupid = 5

The extracted group ID, 5, matches the corresponding property in the VHT configuration object.

Extract the packet length from the VHT-SIG-B information bits. For multiuser operation with an 80 MHz bandwidth, the first 19 bits contain the APEP length information. Convert the field lengths to their decimal equivalents. Multiply them by 4 because the length of the VHT-SIG-B field is expressed in units of 4 bytes.

pktLen = bi2de(double(sigBbits(1:19,:)'))*4
pktLen = 3×1

        2000
        1400
        1800

Confirm that the extracted APEP length matches the value set in the configuration object.

isequal(pktLen',vht.APEPLength)
ans = logical
   1

Extract the MCS values from the VHT-SIG-B information bits. The MCS component is specified by bits 20 to 23.

mcs = bi2de(double(sigBbits(20:23,:)'))
mcs = 3×1

     0
     2
     4

The values correspond to those set in the VHT configuration object.

Create three data sequences, one for each user.

d1 = randi([0 1],vht.PSDULength(1)*8,1);
d2 = randi([0 1],vht.PSDULength(2)*8,1);
d3 = randi([0 1],vht.PSDULength(3)*8,1);

Generate a VHT data field using these data sequences.

vhtdata = wlanVHTData({d1 d2 d3},vht);

Generate a multiuser VHT waveform with windowing is disabled. Extract the data field from the waveform.

wv = wlanWaveformGenerator({d1 d2 d3},vht,'WindowTransitionTime',0);
wvdata = wv(ind.VHTData(1):ind.VHTData(2),:);

Confirm that the two generation approaches produce identical results.

isequal(vhtdata,wvdata)
ans = logical
   1

Visualize the waveform by plotting its magnitude.

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