Two conditions and not same.
이전 댓글 표시
clear all;
clc;
close all;
sigma = 1;
snrdb = 0:5:40;
p =10^4* 10.^(snrdb/10);
eta = 0.5;
u = 0.55;
yth = 0.1;
alp = 0.4;
R = 1;
h = 2;
eb = 0.1;
m = 2;
T = 1;
pth = 2;
for i= 1:length(snrdb)
j=0;k=0;
M=100000;
A = (yth * sigma) ./ p(i);
B = pth ./ p(i);
C = (yth * T * sigma * (1 - alp)) / (eta * alp * T * p(i) * 2 * (1 - u));
D = eb / (eta * alp * T * p(i));
for N= 1:1:M
c=gamrnd(2,0.5,1);
d2=2;
a=gamrnd(1,1,1);
d1=gamrnd(1,1,1);
snr=a/d1^2;
snr1 = (C .* d2.^2) / (B + D);
snr2 = (C .* d2.^2) / (A + D);
lower_limit = ((C * d2^2 - D * c) * d1^2) / c;
upper_limit = (pth * d1^2) / p(i);
if (a > lower_limit && c > 0.1 && c < 2)
j=j+1;
else
j=j;
end
if (a < lower_limit && c > 0.1 && c < 2)
k=k+1;
else
k=k;
end
end
pout(i)=(j/M);
pout1(i)=k/M;
pout2(i)=1-pout1(i);
end
semilogy(snrdb,pout,'-y','LineWidth',0.6,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',6)
hold on
semilogy(snrdb,pout2,'--r','LineWidth',0.6,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',6)
From the above code value of pout and pout2 must be same, but i am getting different values. PLEASE resolve this.
댓글 수: 2
Dyuman Joshi
2023년 8월 14일
"From the above code value of pout and pout2 must be same"
Why must the values be same? Their definitions are different.
anuradha verma
2023년 8월 14일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
