资源描述:
《mimo ofdm matlab仿真程序一》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、OFDM.m:OFDMSimulator(outerfunction)clearall;A=[11/exp(1)1/exp(2)];%powerdelayprofileN=64;%numberofsymbolsinasingleOFDMsymbolGI=16;%guardintervalMt=1;%numberofTxantennasMr=1;%numberofRxantennassig2=1e-3;%noisevarianceM=8;%maxconstellationbitnumberMgap=10.^(1:(1.7/10):2.7);%gapBtot=100*M
2、t;%total#bitsperOFDMsymbolTransmitIter=50;%#iterationsofsymboltransmissionsforeachchannelinstanceChannelIter=100;%#iterationsofindependentidenticallydistributedchannelinstancesGapIter=length(Mgap);loadENC2.matloadENC4.matloadENC16.matloadENC64.matloadENC256.matTotEbNo=[];Errors=[];EbNo
3、=[];forlGap=1:GapIterlGapgap=Mgap(lGap);totalErrors=0;forlChan=1:ChannelIter%createchannel[Hh_f]=create_channel(Mt,Mr,A,N+GI);%decomposeeachsubchannelinthefrequencydomain[USV]=svd_decompose_channel(Mt,Mr,h_f,N);%bitloading[bits_alloc,energy_alloc]=BitLoad(S,Btot,Mt*N,gap,sig2,M);%energ
4、y_alloc=energy_alloc/(mean(energy_alloc));%energy_alloc=ones(1,128);forlTrans=1:TransmitIter%bitstotransmitx=(randn(1,Btot)>0);%modulatex_mod=modulate(x,bits_alloc,energy_alloc,s2,s4,s16,s64,s256);%precodemodulatedsignalx_pre=precode(Mt,x_mod,V,N);%ifft,withcyclicprefixforeachantennaof
5、dm_symbol=[];fori=1:Mtofdm_symbol=[ofdm_symbol;ifft_cp_tx_blk(x_pre(i:Mt:Mt*(N-1)+i),N,GI)];endofdm_symbol2=reshape(ofdm_symbol,Mt*(N+GI),1);%channely=transpose(channel(sig2,Mt,Mr,ofdm_symbol2,H,N+GI));%fftrec_symbol=[];fori=1:Mtrec_symbol=[rec_symbol;fft_cp_rx_blk(y(i:Mt:Mt*(N+GI-1)+i
6、),N,GI)];endrec_symbol2=reshape(rec_symbol,1,Mt*N);%shapereceivedsignalshaped_vals=shape(rec_symbol2,Mr,U,N);%demodulatey_demod=demodulate(shaped_vals,bits_alloc,energy_alloc,S,s2,s4,s16,s64,s256,c2,c4,c16,c64,c256);%comparisontotalErrors=totalErrors+sum(xor(y_demod,x));endEbNo=[EbNosu
7、m(energy_alloc)/Btot/sig2];endErrors=[ErrorstotalErrors/Btot/ChannelIter/TransmitIter]TotEbNo=[TotEbNomean(EbNo)]EbNo=[];endsemilogx(TotEbNo,Errors);xlabel('Eb/No');ylabel('BER');title('SISOlink,adaptiverateandpower')saveSISO_adaptive2.matErrorsEbNocreate_channel.m:GeneratesaRayleigh