gusucode.com > wlan工具箱matlab源码程序 > wlan/wlan/+wlan/+internal/vhtDataModulate.m
function y = vhtDataModulate(data,pilots,cfgOFDM,cpLen,csh,numTx,spatialMapping,Q) %vhtDataModulate Tone rotation, CSD, spatial mapping and OFDM modulation % % Note: This is an internal undocumented function and its API and/or % functionality may change in subsequent releases. % % Y = vhtDataModulate(DATA,PILOTS,CFGOFDM,CPLEN,CSH,NTX,SPATIALMAPPING,Q) % performs tone rotation, CSD, spatial mapping and OFDM modulation. % % Y is an Ns-by-Nt matrix containing the modulated VHT-Data field. Ns is % the number of samples and Nt is the number of transmit antennas. % % DATA is an Nsd-by-Nsym matrix containing data symbols, where Nsd is the % number of data carrying subcarriers and Nsym is the number of OFDM % symbols. % % PILOTS is a Nsp-by-Nsym matrix containing pilot symbols, where Nsp is % the number of pilot carrying subcarriers. % % CFGOFDM is the OFDM configuration structure. % % CPLEN is a scalar integer or row vector of Nsym element specifying the % cyclic prefix length in samples per OFDM symbol. If a scalar the same % length is used for all OFDM symbols % % CSH is the cyclic shift to apply per space-time stream. % % NTX is the number of transmit antennas. % % SPATIALMAPPING is a string specifying the type of spatial mapping. % % Q is a custom spatial mapping matrix. % Copyright 2016 The MathWorks, Inc. %#codegen % Permute to Nsp-by-Nsts-by-Nsym for efficient accessing pilots = permute(pilots,[1 3 2]); % Use the number of pilot symbols to repeat indices for mapping; this % allows traveling or fixed pilots for S1G numPsym = size(cfgOFDM.PilotIndices,2); numOFDMSym = size(data,2); numSTSTotal = numel(csh); packedData = complex(zeros(cfgOFDM.FFTLength,numSTSTotal)); dataSpatialMapped = complex(zeros(cfgOFDM.FFTLength,numOFDMSym,numTx)); for i = 1:numOFDMSym % Data packing with pilot insertion packedData(cfgOFDM.DataIndices(:,mod(i-1,numPsym)+1),:) = data(:,i,:); packedData(cfgOFDM.PilotIndices(:,mod(i-1,numPsym)+1),:) = pilots(:,:,i); % Tone rotation rotatedData = bsxfun(@times,packedData,cfgOFDM.CarrierRotations); % Cyclic shift dataCycShift = wlan.internal.wlanCyclicShift(rotatedData,csh,cfgOFDM.FFTLength,'Tx'); % Spatial mapping dataSpatialMapped(:,i,:) = wlan.internal.wlanSpatialMapping(dataCycShift,spatialMapping,numTx,Q); end % OFDM modulate y = wlan.internal.wlanOFDMModulate(dataSpatialMapped,cpLen)*cfgOFDM.NormalizationFactor; end