www.gusucode.com > wlan 源码程序 matlab案例代码 > wlan/RecoverVHTDataFrom2x2MIMOChannelExample.m
%% Recover VHT Data from 2x2 MIMO Channel % Transmit a VHT-LTF and a VHT data field through a noisy 2x2 MIMO channel. % Demodulate the received VHT-LTF to estimate the channel coefficients. % Recover the VHT data and determine the number of bit errors. %% % Set the channel bandwidth and corresponding sample rate. bw = 'CBW160'; fs = 160e6; %% % Create VHT-LTF and VHT data fields having two transmit antennas and two % space-time streams. cfg = wlanVHTConfig('ChannelBandwidth',bw, ... 'NumTransmitAntennas',2,'NumSpaceTimeStreams',2); txPSDU = randi([0 1],8*cfg.PSDULength,1); txLTF = wlanVHTLTF(cfg); txDataSig = wlanVHTData(txPSDU,cfg); %% % Create a 2x2 MIMO TGac channel. tgacChan = wlanTGacChannel('SampleRate',fs,'ChannelBandwidth',bw, ... 'NumTransmitAntennas',2,'NumReceiveAntennas',2); %% % Create an AWGN channel noise, setting SNR = 15 dB. chNoise = comm.AWGNChannel('NoiseMethod','Signal to noise ratio (SNR)',... 'SNR',15); %% % Pass the signals through the TGac channel and noise models. rxLTF = chNoise(tgacChan(txLTF)); rxDataSig = chNoise(tgacChan(txDataSig)); %% % Create an AWGN channel for a 160 MHz channel with a 9 dB noise figure. % The noise variance, |nVar|, is equal to _kTBF_, where _k_ is Boltzmann's % constant, _T_ is the ambient temperature of 290 K, _B_ is the bandwidth % (sample rate), and _F_ is the receiver noise figure. nVar = 10^((-228.6 + 10*log10(290) + 10*log10(fs) + 9)/10); rxNoise = comm.AWGNChannel('NoiseMethod','Variance','Variance',nVar); %% % Pass the signals through the reciever noise model. rxLTF = rxNoise(rxLTF); rxDataSig = rxNoise(rxDataSig); %% % Demodulate the VHT-LTF. Use the demodulated signal to estimate the % channel coefficients. dLTF = wlanVHTLTFDemodulate(rxLTF,cfg); chEst = wlanVHTLTFChannelEstimate(dLTF,cfg); %% % Recover the data and determine the number of bit errors. rxPSDU = wlanVHTDataRecover(rxDataSig,chEst,nVar,cfg); numErr = biterr(txPSDU,rxPSDU)