gusucode.com > wlan工具箱matlab源码程序 > wlan/wlan/+wlan/+internal/vhtLTFModulate.m

    function y = vhtLTFModulate(LTF,P,R,Nltf,cfgOFDM,csh,numTx,spatialMapping,Q)
%vhtLTFModulate VHT-LTF tone rotation, CSD, spatial mapping and modulation
%
%   Note: This is an internal undocumented function and its API and/or
%   functionality may change in subsequent releases.
%
%   Y = vhtLTFModulate(LTF,P,R,NLTF,CFGOFDM,CSH,NUMTX,SPATIALMAPPING,Q)
%   returns modulated VHT-LTF samples. This process includes tone rotation,
%   CSD, spatial mapping and OFDM modulation.
%
%   LTF is the frequency domain VHT-LTF sequence.
%
%   P and R are the orthogonal mapping matrices for data and pilots.
%
%   NLTF is the number of LTFs
%
%   CFGOFDM is the OFDM configuration structure.
%
%   CSH is the cyclic shift to apply per space-time stream.
%
%   NUMTX 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

% Tone rotation
vhtltfToneRotated = LTF.*cfgOFDM.CarrierRotations;

% Define VHTLTF and output variable sizes
numSTS = numel(csh); % CSH is 1 element per STS
vhtltfSTS = complex(zeros(cfgOFDM.FFTLength,numSTS));
vltfLength = cfgOFDM.FFTLength+cfgOFDM.CyclicPrefixLength;
y = complex(zeros(vltfLength*Nltf,numTx));

% Generate and modulate each VHT-LTF symbol
for i = 1:Nltf
    % Map data and pilot subcarriers and apply P and R mapping matrices
    vhtltfSTS(cfgOFDM.DataIndices,:) = bsxfun(@times, ...
        vhtltfToneRotated(cfgOFDM.DataIndices),P(:, i).');
    vhtltfSTS(cfgOFDM.PilotIndices,:) = bsxfun(@times, ...
        vhtltfToneRotated(cfgOFDM.PilotIndices),R(:, i).');    
    
    % Cyclic shift addition.
    % The cyclic shift is applied per user per stream.
    vltfCSD =  wlan.internal.wlanCyclicShift(vhtltfSTS,csh,cfgOFDM.FFTLength,'Tx');
    
    % Spatial mapping
    vltfSpatialMapped = wlan.internal.wlanSpatialMapping(vltfCSD,spatialMapping,numTx,Q);

    % OFDM modulation
    modOut = ifft(ifftshift(vltfSpatialMapped,1),[],1); 
    tmp = [modOut(end-cfgOFDM.CyclicPrefixLength+1:end,:); modOut];
    y((i-1)*vltfLength+(1:vltfLength),:) = tmp*cfgOFDM.NormalizationFactor;           
end

end