i want to plot 4 craves but my code only plot three

1 次查看(过去 30 天)
Nt = [1 1 4 4];
Nr = [1 4 1 4];
gammaBar = -10:1:0;
SNR = 10 .^(gammaBar/10);
H = sqrt(1/2) * (randn+1j*randn);
for idx = 1:1:length(SNR)
cdf1(idx) = log2(det((eye(Nr(1)))+((SNR(idx)/Nt(1))*abs(H)*(abs(H')))));
cdf2(idx) = log2(det((eye(Nr(2)))+((SNR(idx)/Nt(2))*abs(H)*(abs(H')))));
cdf3(idx) = log2(det((eye(Nr(3)))+((SNR(idx)/Nt(3))*abs(H)*(abs(H')))));
cdf4(idx) = log2(det((eye(Nr(4)))+((SNR(idx)/Nt(4))*abs(H)*(abs(H')))));
end
figure(1)
plot(gammaBar, cdf1, gammaBar, cdf2, gammaBar, cdf3,gammaBar,cdf4)
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');

回答(1 个)

Voss
Voss 2022-10-26
cdf1 and cdf4 are almost the same:
Nt = [1 1 4 4];
Nr = [1 4 1 4];
gammaBar = -10:1:0;
SNR = 10 .^(gammaBar/10);
H = sqrt(1/2) * (randn+1j*randn);
for idx = 1:1:length(SNR)
cdf1(idx) = log2(det((eye(Nr(1)))+((SNR(idx)/Nt(1))*abs(H)*(abs(H')))));
cdf2(idx) = log2(det((eye(Nr(2)))+((SNR(idx)/Nt(2))*abs(H)*(abs(H')))));
cdf3(idx) = log2(det((eye(Nr(3)))+((SNR(idx)/Nt(3))*abs(H)*(abs(H')))));
cdf4(idx) = log2(det((eye(Nr(4)))+((SNR(idx)/Nt(4))*abs(H)*(abs(H')))));
end
figure(1)
max(abs(cdf1-cdf4))
ans = 9.2287e-16
plot(gammaBar, cdf1, '-x', gammaBar, cdf2, gammaBar, cdf3, gammaBar, cdf4, '--o')
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');
legend()

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by