Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Ali Al raeesi
Ali Al raeesi am 26 Okt. 2022
Beantwortet: Voss am 26 Okt. 2022
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');

Antworten (1)

Voss
Voss am 26 Okt. 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))
ans = 9.2287e-16
plot(gammaBar, cdf1, '-x', gammaBar, cdf2, gammaBar, cdf3, gammaBar, cdf4, '--o')
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');
legend()

Kategorien

Mehr zu Linear and Nonlinear Regression finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by