gusucode.com > wlan工具箱matlab源码程序 > wlan/wlan/wlanVHTLTFDemodulate.m
function y = wlanVHTLTFDemodulate(rxVHTLTF,cfgVHT,varargin) %wlanVHTLTFDemodulate OFDM demodulate VHT-LTF signal % % Y = wlanVHTLTFDemodulate(RXVHTLTF,CFGVHT) demodulates the time-domain % VHT-LTF received signal for the VHT transmission format. % % Y is the frequency-domain signal corresponding to the VHT-LTF, returned % as a complex matrix or 3-D array of size Nst-by-Nsym-by-Nr. Nst % represents the number of data and pilot subcarriers in the VHT-LTF. % Nsym represents the number of OFDM symbols in the VHT-LTF. Nr % represents the number of receive antennas. % % RXVHTLTF is the received time-domain VHT-LTF signal, specified as a % complex matrix of size Ns-by-Nr. Ns represents the number of samples, % which can be greater than or equal to the VHT-LTF length, lenVHT, % where only the first lenVHT samples of RXVHTLTF are used. % % CFGVHT is the format configuration object of type <a href="matlab:help('wlanVHTConfig')">wlanVHTConfig</a>, which % specifies the parameters for the VHT format. % % Y = wlanVHTLTFDemodulate(RXVHTLTF,CHANBW,NUMSTS) demodulates the % received signal for the specified channel bandwidth, CHANBW, and the % number of space-time streams, NUMSTS. Both CHANBW and NUMSTS have the % same attributes as the corresponding ChannelBandwidth and % NumSpaceTimeStreams properties of the wlanVHTConfig format % configuration object. % % Y = wlanVHTLTFDemodulate(...,SYMOFFSET) specifies the optional OFDM % symbol sampling offset as a fraction of the cyclic prefix length % between 0 and 1, inclusive. When unspecified, a value of 0.75 is used. % % Example: Demodulate a received VHT-LTF signal % % cfgVHT = wlanVHTConfig; % VHT format configuration % txVHTLTF = wlanVHTLTF(cfgVHT); % VHT-LTF generation % % rxVHTLTF = awgn(txVHTLTF, 1, 1); % Add noise % y = wlanVHTLTFDemodulate(rxVHTLTF,cfgVHT); % Demodulate % % See also wlanVHTLTF, wlanVHTConfig, wlanVHTLTFChannelEstimate. % Copyright 2015-2016 The MathWorks, Inc. %#codegen narginchk(2,4); if ischar(cfgVHT) % chanBW input narginchk(3,4); wlan.internal.validateParam('CHANBW', cfgVHT, mfilename); chanBW = cfgVHT; numSTSVec = varargin{1}; wlan.internal.validateParam('NUMSTS', numSTSVec, mfilename); if nargin == 4 symOffsetSpec = true; symOffset = varargin{2}; else symOffsetSpec = false; end else % VHT config object input narginchk(2,3); % cfgVHT validation validateattributes(cfgVHT, {'wlanVHTConfig'}, {'scalar'}, mfilename, ... 'VHT format configuration object'); % Dependent validation not needed for CHANBW, numSTS properties chanBW = cfgVHT.ChannelBandwidth; numSTSVec = cfgVHT.NumSpaceTimeStreams; if nargin == 3 symOffsetSpec = true; symOffset = varargin{1}; else symOffsetSpec = false; end end % Input rxVHTLTF validation validateattributes(rxVHTLTF, {'double'}, {'2d', 'finite'}, ... 'rxVHTLTF', 'VHT-LTF signal'); numRx = size(rxVHTLTF, 2); if size(rxVHTLTF, 1) == 0 y = zeros(0, 0, numRx); return; end % Validate symOffset, if specified, else, set default if symOffsetSpec validateattributes(symOffset, {'double'}, ... {'real','scalar','>=',0,'<=',1}, mfilename, 'SYMOFFSET'); else % set default symOffset = 0.75; end numSymTable = [1, 2, 4, 4, 6, 6, 8, 8]; numSTSTotal = sum(numSTSVec); numSym = numSymTable(numSTSTotal); % Get OFDM configuration cfgOFDM = wlan.internal.wlanGetOFDMConfig(chanBW, 'Long', ... 'VHT', numSTSTotal); [~, sortedDataPilotIdx] = sort([cfgOFDM.DataIndices; cfgOFDM.PilotIndices]); % Cross-validation between inputs minInpLen = numSym*(cfgOFDM.FFTLength+cfgOFDM.CyclicPrefixLength); coder.internal.errorIf(size(rxVHTLTF, 1) < minInpLen, ... 'wlan:wlanVHTLTFDemodulate:ShortDataInput', minInpLen); % OFDM demodulation [ofdmDemodData, ofdmDemodPilots] = wlan.internal.wlanOFDMDemodulate( ... rxVHTLTF(1:minInpLen,:), cfgOFDM, symOffset); % Sort data and pilot subcarriers ofdmDemod = [ofdmDemodData; ofdmDemodPilots]; y = ofdmDemod(sortedDataPilotIdx, :, :); end % [EOF]