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');
댓글 수: 0
답변 (1개)
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))
plot(gammaBar, cdf1, '-x', gammaBar, cdf2, gammaBar, cdf3, gammaBar, cdf4, '--o')
xlabel('SNR in dB');
ylabel('Ergodic Channel Capacity');
legend()
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Purple에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!