i want to plot 4 craves but my code only plot three
1 view (last 30 days)
Show older comments
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');
0 Comments
Answers (1)
Voss
on 26 Oct 2022
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))
plot(gammaBar, cdf1, '-x', gammaBar, cdf2, gammaBar, cdf3, gammaBar, cdf4, '--o')
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');
legend()
0 Comments
See Also
Categories
Find more on Purple in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!