N = 25;
sigmaratio = 0.01;
PD = zeros(1,1000);
SNR = zeros(1,1000);
PF = 0.00001;
count = 0;
for sigmaratio=0.01:0.01:10
count=count+1;
TH = sqrt(sigmaratio/N) * chi2inv(PF);
SNR(count) = 10*log10(sigmaratio);
PD(count) = chi2cdf(PF)*(TH/(sigmaratio+1));
end
figure;
plot(SNR, PD, 'b-');
xlabel('Signal to noise ratio(DB)');
ylabel('Probability of detection, PD');
hold on;
PF = PF*10;
count = 0;
for sigmaratio=0.01:0.01:10
count=count+1;
TH = sqrt(sigmaratio/N) * chi2inv(PF);
PD(count) = chi2cdf(PF)*(TH/(sigmaratio+1));
end
plot(SNR, PD, 'b-');
hold on;
PF = PF*10;
count = 0;
for sigmaratio=0.01:0.01:10
count=count+1;
TH = sqrt(sigmaratio/N) * chi2inv(PF);
PD(count) = chi2cdf(PF)*(TH/(sigmaratio+1));
end
plot(SNR, PD, 'b-');
hold on;
PF = PF*10;
count = 0;
for sigmaratio=0.01:0.01:10
count=count+1;
TH = sqrt(sigmaratio/N) * chi2inv(PF);
PD(count) = chi2cdf(PF)*(TH/(sigmaratio+1));
end
plot(SNR, PD, 'b-');
hold on;
PF = PF*10;
count = 0;
for sigmaratio=0.01:0.01:10
count=count+1;
TH = sqrt(sigmaratio/N) * chi2inv(PF);
PD(count) = chi2cdf(PF)*(TH/(sigmaratio+1));
end
plot(SNR, PD, 'b-');
hold on;

댓글 수: 1

Stephen23
Stephen23 2016년 7월 20일
"Whats wrong with this code?"
No comments, no explanation, no introduction, no help, no examples, no idea what it should do...

댓글을 달려면 로그인하십시오.

 채택된 답변

dpb
dpb 2016년 7월 20일

0 개 추천

Trying to run it, I get--
...
Error using chi2inv (line 22)
Requires two input arguments.
>>
Don't know what the intent is and with, as you note Stephen, no explanations, I'm not going to try to divine but need a DOF argument as the second argument to chi2inv
Whether that should be N or perhaps count OP will have to determine...

댓글 수: 2

dpb
dpb 2016년 7월 20일
Moved OP's "Answer" followup here--dpb
I need to obtain this graph. Can you guide me through the coding?
dpb
dpb 2016년 7월 20일
Well, what else do you need besides that which I've already pointed out? I have no way of knowing the response function; what "Energy Detector" in particular???

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Just for fun에 대해 자세히 알아보기

질문:

2016년 7월 20일

댓글:

dpb
2016년 7월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by