mimo系统 注水算法.docxVIP

  • 33
  • 0
  • 约2.5千字
  • 约 3页
  • 2017-12-24 发布于河南
  • 举报
mimo系统 注水算法

function [gn,en_bar,bn_bar,Nstar,b_bar]=waterfill(P,SNRmfb,Ex_bar,Ntot,gap)% function [gn,en_bar,bn_bar,Nstar,b_bar]=waterfill(P,SNRmfb,Ex_bar,N,gap)%% P is the pulse response% SNRmfb is the SNRmfb in dB% Ex_bar is the normalized energy% Ntot is the total number of real/complex subchannels, Ntot2% gap is the gap in dB%% gn is channel gain% en_bar is the energy/dim in the nth subchannel% bn_bar is the bit/dim in the nth subchannel% Nstar is the number of subchannel used% b_bar is the bit rate% dB into normal scaleNoise_var=Ex_bar*(norm(P)^2)/(10^(SNRmfb/10));gap=10^(gap/10);% initializationen=zeros(1,Ntot);bn=zeros(1,Ntot);gn=zeros(1,Ntot);Hn = zeros(1,Ntot);% subchannel center frequenciesf=-1/2+1/Ntot:1/Ntot:1/2;% find Hn vectorfor i=1:length(P)Hn=Hn+P(i)*exp(j*2*pi*f*(i-1)); % This value will be different depending if P represents % P(1) + P(2)*D^-1 + .... or P(1) + P(2)*D^+1...., % but well get same gn, thus same waterfilling result. % (Note that both have the same magnitude response!)end% find gn vectorgn=abs(Hn).^2/Noise_var;%plot(gn)%%%%%%%%%%%%%%%%%%%%%%%% Now do waterfilling %%%%%%%%%%%%%%%%%%%%%%%%%sort[gn_sorted, Index]=sort(gn); % sort gain, and get Indexgn_sorted = fliplr(gn_sorted);% flip left/right to get the largest % gain in leftsideIndex = fliplr(Index); % also flip index num_zero_gn = length(find(gn_sorted == 0)); %number of zero gain subchannelsNstar=Ntot - num_zero_gn; % Number of used channels, % start from Ntot - (number of zero gain subchannels)while(1) K=1/Nstar*(Ntot*Ex_bar+gap*sum(1./gn_sorted(1:Nstar))); En_min=K-gap/gn_sorted(Nstar);% En_min occurs in the worst channel if (En_min0) Nstar=Nstar-1; % If negative En, continue with less channels else break; % If all En positive, done. endendEn=K-gap./gn_sorted(1:Nstar); % Calculate EnBn=.5*log2(K*gn_sorted(1:Nstar)/gap); % Calculate bnbn(Index(1:Nstar))=Bn;% return values in original indexen(Index(1:Nstar))=En;% return values in original indexmiddle = Ntot/2;% Since cha

文档评论(0)

1亿VIP精品文档

相关文档