我现在正在使用MATLAB来计算具有CSI的MIMO信道的容量。 因此,我需要使用水填充来获得功率水平....但是我有一些问题,结果图是向下凹的。 任何人都可以给我一些建议,我做错了吗?
clear
nr=2;
nt=2;
minN = min(nr,nt);
transmitSNR = -20;
for k=1:21 %- set the value of Po/No in dB
for m=1:1000
for t=1:nr
for y=1:nt
a=1/sqrt(2)*randn(nr,nt);
b=1/sqrt(2)*randn(nr,nt);
H=a+1i*b; %- complex form of H
end
end
%- Hr=R^1/2*H;
[S V D]=svd(H);
cap(m)=0;
for n=1:1:minN
lambda(n) = V(n,n);
end
[lambda L] = sort(lambda,'descend');
lambda = lambda(find(lambda > 0)); % ignoring non-positive eigenvalues
pl = -1;
try
while (min(pl) < 0)
mu = (transmitSNR + sum(1 ./ lambda)) / length(lambda);
pl = mu - 1 ./ lambda;
lambda = lambda(1:end-1);
end
catch
disp('There exists no water filling level for the input eigenvalues. Check your data and try again')
end
pl = [pl; zeros(length(L) - length(pl), 1)]; % assigning zero power for weak eigen-modes
pl(L) = pl;
for n=1:1:minN
cap(m) = cap(m) + sum( log2(1 + pl(n).*lambda));
end
end
capacity(k)=mean(cap);
SNR(k) = transmitSNR;
transmitSNR = transmitSNR+2;
end
plot (SNR,capacity,'d-m'); hold on;
title('Graph of SNR & channel capacity');
xlabel('SNR,dB');
ylabel('Channel capacity');
答案 0 :(得分:0)
我对上述问题的解决方案是:
SNR_dB=-20; % Here is your SNR in dB
transmitSNR=10.^(SNR_dB./10); % Here is the conversion