




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
精品文档 1欢迎下载 OFDM mOFDM m OFDMOFDM SimulatorSimulator outer outer function function clear all A 1 1 exp 1 1 exp 2 power delay profile N 64 number of symbols in a single OFDM symbol GI 16 guard interval Mt 1 number of Tx antennas Mr 1 number of Rx antennas sig2 1e 3 noise variance M 8 max constellation bit number Mgap 10 1 1 7 10 2 7 gap Btot 100 Mt total bits per OFDM symbol TransmitIter 50 iterations of symbol transmissions for each channel instance ChannelIter 100 iterations of independent identically distributed channel instances GapIter length Mgap load ENC2 mat load ENC4 mat load ENC16 mat load ENC64 mat load ENC256 mat TotEbNo Errors EbNo for lGap 1 GapIter lGap gap Mgap lGap totalErrors 0 for lChan 1 ChannelIter create channel H h f create channel Mt Mr A N GI decompose each subchannel in the frequency domain U S V svd decompose channel Mt Mr h f N bitloading bits alloc energy alloc BitLoad S Btot Mt N gap sig2 M energy alloc energy alloc mean energy alloc energy alloc ones 1 128 for lTrans 1 TransmitIter bits to transmit x randn 1 Btot 0 精品文档 2欢迎下载 modulate x mod modulate x bits alloc energy alloc s2 s4 s16 s64 s256 precode modulated signal x pre precode Mt x mod V N ifft with cyclic prefix for each antenna ofdm symbol for i 1 Mt ofdm symbol ofdm symbol ifft cp tx blk x pre i Mt Mt N 1 i N GI end ofdm symbol2 reshape ofdm symbol Mt N GI 1 channel y transpose channel sig2 Mt Mr ofdm symbol2 H N GI fft rec symbol for i 1 Mt rec symbol rec symbol fft cp rx blk y i Mt Mt N GI 1 i N GI end rec symbol2 reshape rec symbol 1 Mt N shape received signal shaped vals shape rec symbol2 Mr U N demodulate y demod demodulate shaped vals bits alloc energy alloc S s2 s4 s16 s64 s256 c2 c4 c16 c64 c256 comparison totalErrors totalErrors sum xor y demod x end EbNo EbNo sum energy alloc Btot sig2 end Errors Errors totalErrors Btot ChannelIter TransmitIter TotEbNo TotEbNo mean EbNo EbNo end semilogx TotEbNo Errors xlabel Eb No ylabel BER title SISO link adaptive rate and power 精品文档 3欢迎下载 save SISO adaptive2 mat Errors EbNo create channel mcreate channel m GeneratesGenerates a a RayleighRayleigh fadingfading frequency selectivefrequency selective channel channel parametrizedparametrized byby thethe antennaantenna configuration configuration thethe OFDMOFDM configuration configuration andand thethe power power delaydelay profile profile function H H f create channel Mt Mr A N function H H f create channel Mt Mr A N A vector containing the power delay profile real values Mt number of Tx antennas Mr number of Rx antennas N number of vector symbols to be sent in a single OFDM symbol Tx ie N MIMO transmissions in one OFDM symbol This is for Rayleigh frequency selective fading which assumes complex Gaussian matrix elements with in phase and quadrature components independent Assume iid matrix channel elements and further independent channel taps define the channel taps H int 1 sqrt 2 randn Mr length A Mt j randn Mr length A Mt H int2 for i 1 length A H int2 H int2 sqrt A i H int i 1 Mr 1 i Mr end h f fft H int2 64 H H int2 H int2 H int2 zeros N length A Mr Mt H f zeros Mr Mt N 16 for i 1 Mt for j 1 Mr h f fft H int2 j Mr N 16 1 Mr j i for k 1 N 16 H f j i k 1 Mt h f k end end end H H int2 for i 1 N 1 H H zeros Mr i Mt H int2 1 N i Mr end svd decompose channel msvd decompose channel m SinceSince fullfull channelchannel knowledgeknowledge isis assumed assumed transmissiontransmission isis 精品文档 4欢迎下载 acrossacross parallelparallel singularsingular valuevalue modes modes ThisThis functionfunction decomposesdecomposes thethe channelchannel intointo thesethese modes modes function U S V svd decompose channel Mt Mr h f N U S V svd decompose channel Mt Mr h f N Function decomposes the channel at each subcarrier into its SVD components Mt Tx antennas Mr Rx antennas h f MIMO impulse response Mr rows Mt L columns where L is the number of channel taps N subcarriers U S V for i 1 N Utmp Stmp Vtmp svd h f i 1 Mt 1 i Mt U U Utmp V V Vtmp S S Stmp end S sum S 1 BitLoad mBitLoad m ApplyApply thethe bit loadingbit loading algorithmalgorithm toto achieveachieve thethe desireddesired bitbit andand energyenergy allocationallocation forfor thethe currentcurrent channelchannel instance instance function bits alloc energy alloc BitLoad subchan gains total bits num subc gap noise M Bit Loading Algorithm Inputs subchan gains SubCarrier Gains total bits Total Number of bits num subc Number of Subcarriers gap Gap of the system noise Noise Power M Max Constellation Size Outputs bits alloc Bits allocation for each subchannel power alloc Total Power allocation Compute SNR s for each channel SNR ComputeSNR subchan gains noise gap 精品文档 5欢迎下载 This function just initializes the system with a particular bit allocation and energy allocation using Chow s Algorithm This is further efficientize using Campello s Algorithm bits alloc energy alloc chow algo SNR num subc M Form the Energy Increment Table based on the present channel gains for all the subchannels in order to be used by Campello Algorithm energytable EnergyTableInit SNR M Efficientize the algorithm using the Campello s algorithm bits alloc energy alloc campello algo bits alloc energy alloc energytable total bits num subc M ComputeSNR mComputeSNR m GivenGiven thethe subcarriersubcarrier gains gains thisthis simplesimple functionfunction generatesgenerates thethe SNRSNR valuesvalues ofof eacheach channelchannel each each singularsingular valuevalue onon eacheach tonetone isis a a separateseparate channel channel function SNR ComputeSNR subcar gains noise gap SNR abs subcar gains 2 noise gap chow algo mchow algo m ApplyApply Chow sChow s algorithmalgorithm toto generategenerate a a particularparticular bitbit andand energyenergy allocation allocation Chow s Algorithm This is based on the paper by Chow et al titled A Practical Discrete Multitone Transceiver Loading Algorithm for Data Transmission over Spectrally Shaped Channels IEEE Trans on Communications Vol 43 No 2 3 4 pp 773 775 Feb Mar Apr 1995 function bits alloc energy alloc chow algo SNR num subc M for i 1 num subc Assuming each of the subchannels has a flat fading we get initial estimate of the bits for each subchannel tempbits log2 1 abs SNR i bits per two dimension roundtempbits round tempbits round the bits if roundtempbits 8 Limit them between 2 and 15 roundtempbits 8 end 精品文档 6欢迎下载 if mod roundtempbits 2 1 end if roundtempbits 0 Calculate the Energy required for the subchannel energy alloc i 2 roundtempbits 1 SNR i else energy alloc i 0 end bits alloc i roundtempbits Update the BitSubChan end end of function EnergyTableInit mEnergyTableInit m GivenGiven thethe SNRSNR values values formform a a tabletable ofof energyenergy incrementsincrements forfor eacheach channel channel function energytable EnergyTableInit SNR M Inputs subcar gains Subcarrier Gains M max Constellation Size Gap Gap of the system Noise Noise Power Outputs energytable Energytable Based on the Subcarrier Gains we calculate the energy increment required by each subcarrier for transmitting 1 2 4 6 8 bits Energy 2 i 1 subcar gains subcar gains subcar gains 2 Gap Noise energytable abs 1 SNR 2 1 M 1 1 Increase the energy value for constellation size of more than M to a very high value so that it is not assigned energytable M 1 Inf ones size energytable M 1 for i 3 2 M energytable i energytable i energytable i 1 2 energytable i 1 energytable i 精品文档 7欢迎下载 end energytable ones 1 size energytable 1 energytable campello algo mcampello algo m ApplyApply Campello sCampello s algorithmalgorithm toto convergeconverge toto thethe optimaloptimal bitbit andand energyenergy allocationallocation forfor thethe givengiven channelchannel conditions conditions campello algo m This function is used by Campello s algorithm to allocate bits and energy for each subchannel optimally function bits alloc energy alloc campello algo bits alloc energy alloc energytable total bits num subc M bt sum bits alloc We can t transmit more than M Number of subchannel bits if total bits M num subc total bits M num subc end while bt total bits if bt total bits max val 0 max ind ceil rand 1 num subc for i 1 num subc i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
评论
0/150
提交评论