Graphics Programs Reference
In-Depth Information
Listing 2.24. MATLAB Program Ðfig2_14.mÑ
% This program is used to produce Fig. 2.14
clear all
pfa = 1e-9;
nfa = log(2) / pfa;
index = 0;
for snr = -10:.5:30
index = index +1;
prob1(index) = pd_swerling4 (nfa, 1, snr);
prob10(index) = pd_swerling4 (nfa, 10, snr);
prob50(index) = pd_swerling4(nfa, 50, snr);
prob100(index) = pd_swerling4 (nfa, 100, snr);
end
x = -10:.5:30;
plot(x, prob1,'k',x,prob10,'k:',x,prob50,'k--', ...
x, prob100,'k-.');
axis([-10 30 0 1.1])
xlabel ('SNR - dB')
ylabel ('Probability of detection')
legend('np = 1','np = 10','np = 50','np = 100')
grid
axis tight
Listing 2.25. MATLAB Function Ðfluct_loss.mÑ
function [Lf,Pd_Sw5] = fluct_loss(pd, pfa, np, sw_case)
% This function calculates the SNR fluctuation loss for Swerling models
% A negative Lf value indicates SNR gain instead of loss
format long
% compute the false alarm number
nfa = log(2) / pfa;
% *************** Swerling 5 case ****************
% check to make sure that np>1
if (np ==1)
b = sqrt(-2.0 * log(pfa));
Pd_Sw5 = 0.001;
snr_inc = 0.1 - 0.005;
while(Pd_Sw5 <= pd)
snr_inc = snr_inc + 0.005;
a = sqrt(2.0 * 10^(.1*snr_inc));
Pd_Sw5 = marcumsq(a,b);
end
PD_SW5 = Pd_Sw5
Search WWH ::




Custom Search