MIMO-OFDM系统仿真_第1页
MIMO-OFDM系统仿真_第2页
MIMO-OFDM系统仿真_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

clear all;clc;frmLen = 300; % frame length帧长numPackets = 10; % number of packets帧数Nsamp=frmLen*numPackets;EbNo = 2:2:20; % Eb/No varying to 20 dBNt = 4; % maximum number of Tx antennasNr = 2; % maximum number of Rx antennasN_FFT=400;Nc=N_FFT;hStr = RandStream(mt19937ar, Seed, 55408);% Create QPSK mod-demod objectsP = 4; % modulation orderqpskmod = modem.pskmod(M, P, SymbolOrder, Gray);qpskdemod = modem.pskdemod(qpskmod);% Create comm.OSTBCEncoder and comm.OSTBCCombiner System objects hOSTBCEnc = comm.OSTBCEncoder(. NumTransmitAntennas, Nt); hOSTBCComb = comm.OSTBCCombiner(. NumTransmitAntennas, Nt,. NumReceiveAntennas, Nr);%rho = 0.7; % Correlation coefficient = antenna correlationRsym = 10e3; % Input symbol rateRbit = Rsym * log2(P); % Input bit rateNos = 4; % Oversampling factorts = (1/Rbit) / Nos; % Input sample period 12.5usfs=Rbit*Nos;% tau = 0 0.4 0.9*1e-6; % Path delays, in seconds% pdb = 0 -15 -20; % Average path gains, in dB% dop = doppler.rounded; % Doppler spectrum, with default parametersfd = 0.5; % h = mimochan(Nt, Nr, ts, fd, tau, pdb); % MIMO channel object% h.KFactor = 4; % Rician K-factor on first path% h.DopplerSpectrum = dop; % Doppler spectrum of MIMO objectTxCorrelationMatrix = toeplitz(1 rho rho2 rho3); % Transmit correlation matrixRxCorrelationMatrix =toeplitz(1 rho);delays=0, 5e-5, 10e-5;delay_samp=round(delays./ts);% Create MIMO channel System object hChan = comm.MIMOChannel(. SampleRate, fs,. MaximumDopplerShift, fd,. NumTransmitAntennas, Nt,. NumReceiveAntennas, Nr,. TransmitCorrelationMatrix, TxCorrelationMatrix,. ReceiveCorrelationMatrix, RxCorrelationMatrix,. PathDelays, delays,. KFactor, 4,. AveragePathGains, 0, -15, -20,. NormalizePathGains, false,. PathGainsOutputPort, true);% Set up a figure for visualizing BER results% h = gcf; grid on; hold on;% set(gca, yscale, log, xlim, EbNo(1), EbNo(end), ylim, 1e-4 1);% xlabel(Eb/No (dB); ylabel(BER); set(h,NumberTitle,off);% set(h, renderer, zbuffer); set(h,Name,Transmit vs. Receive Diversity);% title(Transmit vs. Receive Diversity);cp=1/8*Nc;% ofdmmod=zeros(Nc*numPackets,Nt);% ofdmdemod=zeros(Nc*numPackets,Nr); tranSignal=zeros(cp+Nc)*numPackets,Nt);% Loop over several EbNo pointsfor ii = 1:length(EbNo) data = randi(hStr, 0 P-1, Nsamp, 1); % data vector per user modData= modulate(qpskmod, data); % QPSK modulation % Alamouti Space-Time Block Encoder encData = step(hOSTBCEnc , modData); % Alamouti Space-Time Block Encoder, G2, full rate for i=1:Nt enc=reshape(encData(:,i),Nc,numPackets); ofdmmod=sqrt(Nc)*ifft(enc,N_FFT); trans=ofdmmod(Nc-cp+1:Nc,:);ofdmmod; tranSignal(:,i)=reshape(trans,(cp+Nc)*numPackets,1); end % idx =(1:N_FFT)+(packetIdx-1)*N_FFT ; chanOut, pathGains = step(hChan, tranSignal); % rxSignal(idx,:) = filter(h, encData); rxSignal=awgn(chanOut,EbNo(ii); l2=zeros(cp+Nc)*numPackets,1,Nt,Nr); l3=zeros(cp+Nc)*numPackets,1,Nt,Nr);% l2(1:end,1,:,:)=pathGains(1:end-1,2,:,:); l2(delay_samp(2)+1:end,1,:,:)=pathGains(1:end-delay_samp(2),2,:,:); l3(delay_samp(3)+1:end,1,:,:)=pathGains(1:end-delay_samp(3),3,:,:); H(:,1,:,:)=pathGains(:,1,:,:)+l2+l3;% H=pathGains(:,1,:,:); for i=1:numPackets H_r(1+(i-1)*Nc:i*Nc,:,:,:)=H(1+cp+(i-1)*(Nc+cp):i*(Nc+cp),:,:,:); end for j=1:Nr recv_cp=reshape(rxSignal(:,j),cp+Nc,numPackets); recv=recv_cp(cp+1:Nc+cp,:); ofdmdem=fft(recv,N_FFT)/sqrt(Nc); ofdmdemod(:,j)=reshape(ofd

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论