generate vht multi-凯发k8网页登录
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 = bit2int(double(sigabits(1:2)),2,false)
bw = 2
the value, 2, corresponds to an 80 mhz bandwidth (see ).
extract vht-sig-a information bits 5 through 10, and convert them to their decimal equivalent.
groupid = bit2int(double(sigabits(5:10)),6,false)
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 = bit2int(double(sigbbits(1:19,:)),19,false)'*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 = bit2int(double(sigbbits(20:23,:)),4,false)'
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')