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

1 vue (au cours des 30 derniers jours)
Ali Al raeesi le 26 Oct 2022
Réponse apportée : Voss le 26 Oct 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');
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Voss le 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))
ans = 9.2287e-16
plot(gammaBar, cdf1, '-x', gammaBar, cdf2, gammaBar, cdf3, gammaBar, cdf4, '--o')
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');
legend()
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Linear and Nonlinear Regression dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by