www.gusucode.com > wlan 源码程序 matlab案例代码 > wlan/DetectHTMFFormatWaveformExample.m

    %% Detect HT-MF Format Waveform
% Perform format detection on a WLAN high throughput mixed format (HT-MF)
% waveform.

%%
% Generate an HT-MF waveform and add noise to the transmitted waveform.
cbw = 'CBW20';
cfgTx = wlanHTConfig('ChannelBandwidth',cbw);
tx = wlanWaveformGenerator([1;0;0;1],cfgTx);
snr = 10;
rxSig = awgn(tx,snr);

%% Demodulate Received Signal and Perform Channel Estimation
% * Determine indices for the L-LTF for the 20 MHz bandwidth waveform. For
% this calculation, define local variables for the sample rate and duration
% of the L-STF and L-LTF fields in seconds.
% * Demodulate the L-LTF.
% * Perform channel estimation using the L-LTF.
% * Estimate the noise variance.
sr = 20e6;
Tlstf = 8e-6;
Tlltf = 8e-6;

idxlltf = Tlstf*sr+(1:Tlltf*sr);

lltfDemod = wlanLLTFDemodulate(rxSig(idxlltf,:),cbw);
chEst = wlanLLTFChannelEstimate(lltfDemod,cbw);
noiseVarEst = 10^(-snr/20);

%% Detect Signal Format
% * Determine indices for the three symbols following the L-LTF. For a 20
% MHz bandwidth waveform, the duration for three symbols is 12 $\mu s$.
% * Perform format detection.
idxDetectionSymbols = (Tlstf+Tlltf)*sr+(1:12e-6*sr);

in = rxSig(idxDetectionSymbols,:);
format = wlanFormatDetect(in,chEst,noiseVarEst,cbw)