gusucode.com > wlan工具箱matlab源码程序 > wlan/wlanexamples/vhtSingleUserRxSigRec.m
function [rxDataBits, recVHTSIGBBits] = vhtSingleUserRxSigRec(rxSig, ... chanBW, userNum, eqMethod) % VHT Receiver for a single user % Simple receiver with no front-end impairment correction. % Recovers the transmission configuration using the signaling fields % (assumes only the channel bandwidth and format is known). % Copyright 2016 The MathWorks, Inc. % Only assume chanBW and format known format = 'VHT'; % Configure a recovery object cfgRec = wlanRecoveryConfig('EqualizationMethod', eqMethod, ... 'PilotPhaseTracking', 'None'); fLen = helperFieldLengths(chanBW, format); lltfIndices = fLen.LSTF+(1:fLen.LLTF); rxLLTF = rxSig(lltfIndices,:); % Perform channel estimation based on L-LTF demodLLTF = wlanLLTFDemodulate(rxLLTF, chanBW); chanEstLLTF = wlanLLTFChannelEstimate(demodLLTF, chanBW); % Estimate noise power for legacy fields nVar = helperNoiseEstimate(demodLLTF); % Recover LSIG bits lsigIndices = lltfIndices(end)+(1:fLen.LSIG); rxLSIG = rxSig(lsigIndices,:); recLSIGBits = wlanLSIGRecover(rxLSIG, chanEstLLTF, nVar, chanBW, cfgRec); % Recover SIGA bits sigAIndices = lsigIndices(end)+(1:fLen.VHTSIGA); rxVHTSIGA = rxSig(sigAIndices,:); recVHTSIGABits = wlanVHTSIGARecover(rxVHTSIGA, chanEstLLTF, nVar, ... chanBW, cfgRec); % Recover configuration: BW, numSTS, etc. (not MCS, APEPLEngth yet for MU) cfgVHTRx = helperVHTConfigRecover(recLSIGBits, recVHTSIGABits); % Perform channel estimation based on VHT-LTF numSTSVec = cfgVHTRx.NumSpaceTimeStreams; numSTSTotal = sum(numSTSVec); NVHTLTFVec = [1 2 4 4 6 6 8 8]; vhtltfIndices = (sigAIndices(end)+fLen.VHTSTF) + ... (1:(NVHTLTFVec(numSTSTotal)*fLen.VHTSTF)); rxVHTLTF = rxSig(vhtltfIndices,:); demodVHTLTF = wlanVHTLTFDemodulate(rxVHTLTF, chanBW, numSTSVec); chanEst = wlanVHTLTFChannelEstimate(demodVHTLTF, chanBW, numSTSVec); % Estimate noise power for VHT fields stsU = numSTSVec(userNum); nVar = helperNoiseEstimate(demodLLTF, chanBW, stsU); % Recover SIGB bits per user sigBIndices = vhtltfIndices(end) + (1:fLen.VHTSTF); % one symbol length rxVHTSIGB = rxSig(sigBIndices,:); recVHTSIGBBits = wlanVHTSIGBRecover(rxVHTSIGB, chanEst, nVar, chanBW, ... userNum, numSTSVec, cfgRec); % Recover per user MCS and APEPLengths for user of interest, and % other Tx information [cfgVHTSU, numDataSym] = helperVHTConfigRecover(recLSIGBits, ... recVHTSIGABits, recVHTSIGBBits, userNum); % Recover information bits in VHT Data dataIndices = sigBIndices(end)+(1:(numDataSym*fLen.VHTSTF)); rxVHTData = rxSig(dataIndices,:); [rxDataBits, ~, eqsym] = wlanVHTDataRecover(rxVHTData, chanEst, nVar, ... cfgVHTSU, userNum, numSTSVec, cfgRec); % Plot equalized symbols per-user streams (Nss) h = figure; h.Name = ['User ' num2str(userNum) ' Equalized Symbols']; scaler = ceil(max(abs([real(eqsym(:)); imag(eqsym(:))]))); for i = 1:stsU if stsU>2 subplot(2, 2, i); else subplot(stsU, 1, i); end plot(reshape(eqsym(:,:,i), [], 1), '.'); grid on; xlim([-scaler scaler]); ylim([-scaler scaler]); title(['User ' num2str(userNum) ', Stream ' num2str(i)]); xlabel('Real'); ylabel('Imag'); end end