资源描述:
《mimo ofdm matlab仿真程序续一》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、modulate.m:Modulatetherandominputsequenceaccordingtothebitallocationsforeachchannel.functiony=modulate(x,b,e,s2,s4,s16,s64,s256)%functiony=modulate(x,b,e,s2,s4,s16,s64,s256)%%y-modulatedoutput,intheformofarowvector%x-avectorofinputbits,forallthesubcarriers(rowvector)%b-su
2、bcarrierbitallocation(64elementsinthismatrix,eachone%correspondingtothenumberofbitstobeallocatedtothesubcarrier%havingthesameindex)%e-subcarrierenergyallocation(64elementsinthismatrix,eachone%correspondingtotheenergytobeallocatedtothesubcarrier%havingthesameindex)%s_-thee
3、ncoderforagivenconstellationsizey=[];b2=zeros(1,length(b));b2(1)=1;fori=1:length(b)b2(i+1)=b(i)+b2(i);endfori=1:length(b)switchb(i)case{1}y=[ys2(x(b2(i))+1)*sqrt(e(i))];case{2}y=[ys4(x(b2(i):(b2(i+1)-1))*[2;1]+1)*sqrt(e(i))];case{4}y=[ys16(x(b2(i):(b2(i+1)-1))*[8;4;2;1]+1
4、)*sqrt(e(i))];case{6}y=[ys64(x(b2(i):(b2(i+1)-1))*[32;16;8;4;2;1]+1)*sqrt(e(i))];case{8}y=[ys256(x(b2(i):(b2(i+1)-1))*[128;64;32;16;8;4;2;1]+1)*sqrt(e(i))];otherwise%mustbezerobitsallocatedy=[y0];endend·ENC2.mat:BPSKModulator·ENC4.mat:4-QAMModulator(Graycoded)·ENC16.mat:1
5、6-QAMModulator(Graycoded)·ENC64.mat:64-QAMModulator(Graycoded)·ENC256.mat:256-QAMModulator(Graycoded)precode.m:Precodethetransmittedvectorateachtimeinstancebyfilteringthemodulatedvectorwiththeright-inverseofthechannel'srightsingluarmatrix.function[x_pre]=precode(Mt,x_mod,
6、V,N);%[x_pre]=precode(Mt,x_mod,V,N);%%FunctionprecodesthemodulatedsymbolspriortosendingthroughtheIFFTmodule.Theprecoder%left-multipliesthechannelateachtone,toeliminatetherightunitarymatrixintheSVD%decompositionofthechannel.%%Mt-#transmitantennas%x_mod-modulatedsymbolsfore
7、achtone(thesymbolsaregroupedtogetherintones,ie:for3%MIMOsubchannelspertone,have3consecutivex_modsymbols)%V-thematrixofrightunitarymatricesofthechannel,inroworder%N-#subchannelsx_pre=[];fori=1:Nx_pre=[x_pre;[V(:,(i-1)*Mt+1:i*Mt)]*transpose(x_mod((i-1)*Mt+1:i*Mt))];endx_pre
8、=transpose(x_pre);ifft_cp_tx_blk.m:IFFTblockoftheOFDMsystem.functionofdm_symbol=ifft_cp_tx_blk(i