# 雷达检测及MATLAB仿真（三）

#### ③、Swerling Ⅱ 型目标的检测

n p > 50 n_p > 50np>50 时：

##### 1）MATLAB 源码

fig2_12.m

clear all
pfa = 1e-10;
nfa = log(2) / pfa;
index = 0;
for snr = -10:.5:30
index = index +1;
prob1(index) =  pd_swerling2 (nfa, 1, snr);
prob10(index) =  pd_swerling2 (nfa, 10, snr);
prob50(index) =  pd_swerling2 (nfa, 50, snr);
prob100(index) =  pd_swerling2 (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])
xlabel ('SNR - dB')
ylabel ('Probability of detection')
legend('np = 1','np = 10','np = 50','np = 100')
grid


#### ④、Swerling Ⅲ 型目标的检测

n p = 1 ， 2 n_p=1，2np=12 时：

n p > 2 n_p>2np>2 时：

##### 1）MATLAB 源码

pd_swerling3.m

function pd = pd_swerling3 (nfa, np, snrbar)
% This function is used to calculate the probability of detection
% for Swerling 2 targets.
format long
snrbar = 10.0^(snrbar/10.);
eps = 0.00000001;
delmax = .00001;
delta =10000.;
% Calculate the threshold Vt
pfa =  np * log(2) / nfa;
sqrtpfa = sqrt(-log10(pfa));
sqrtnp = sqrt(np);
vt0 = np - sqrtnp + 2.3 * sqrtpfa * (sqrtpfa + sqrtnp - 1.0);
vt = vt0;
while (abs(delta) >= vt0)
igf = incomplete_gamma(vt0,np);
num = 0.5^(np/nfa) - igf;
temp = (np-1) * log(vt0+eps) - vt0 - factor(np-1);
deno = exp(temp);
vt = vt0 + (num / (deno+eps));
delta = abs(vt - vt0) * 10000.0;
vt0 = vt;
end
temp1 = vt / (1.0 + 0.5 * np *snrbar);
temp2 = 1.0 + 2.0 / (np * snrbar);
temp3 = 2.0 * (np - 2.0) / (np * snrbar);
ko = exp(-temp1) * temp2^(np-2.) * (1.0 + temp1 - temp3);
if (np <= 2)
pd = ko;
return
else
temp4 = vt^(np-1.) * exp(-vt) / (temp1 * exp(factor(np-2.)));
temp5 =  vt / (1.0 + 2.0 / (np *snrbar));
pd = temp4 + 1.0 - incomplete_gamma(vt,np-1.) + ko * ...
incomplete_gamma(temp5,np-1.);
end


fig2_13.m

clear all
pfa = 1e-9;
nfa = log(2) / pfa;
index = 0;
for snr = -10:.5:30
index = index +1;
prob1(index) =  pd_swerling3 (nfa, 1, snr);
prob10(index) =  pd_swerling3 (nfa, 10, snr);
prob50(index) =  pd_swerling3(nfa, 50, snr);
prob100(index) =  pd_swerling3 (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])
xlabel ('SNR - dB')
ylabel ('Probability of detection')
legend('np = 1','np = 10','np = 50','np = 100')
grid


#### ⑤、Swerling Ⅳ 型目标的检测

n p < 50 n_p <50np<50 时：

n p > 50 n_p > 50np>50 时：

##### 1）MATLAB 源码

pd_swerling4.m

function pd = pd_swerling4 (nfa, np, snrbar)
% This function is used to calculate the probability of detection
% for Swerling 4 targets.
format long
snrbar = 10.0^(snrbar/10.);
eps = 0.00000001;
delmax = .00001;
delta =10000.;
% Calculate the threshold Vt
pfa =  np * log(2) / nfa;
sqrtpfa = sqrt(-log10(pfa));
sqrtnp = sqrt(np);
vt0 = np - sqrtnp + 2.3 * sqrtpfa * (sqrtpfa + sqrtnp - 1.0);
vt = vt0;
while (abs(delta) >= vt0)
igf = incomplete_gamma(vt0,np);
num = 0.5^(np/nfa) - igf;
temp = (np-1) * log(vt0+eps) - vt0 - factor(np-1);
deno = exp(temp);
vt = vt0 + (num / (deno+eps));
delta = abs(vt - vt0) * 10000.0;
vt0 = vt;
end
h8 = snrbar /2.0;
beta = 1.0 + h8;
beta2 = 2.0 * beta^2 - 1.0;
beta3 = 2.0 * beta^3;
if (np >= 50)
temp1 = 2.0 * beta -1;
omegabar = sqrt(np * temp1);
c3 = (beta3 - 1.) / 3.0 / beta2 / omegabar;
c4 = (beta3 * beta3 - 1.0) / 4. / np /beta2 /beta2;;
c6 = c3 * c3 /2.0;
V = (vt - np * (1.0 + snrbar)) / omegabar;
Vsqr = V *V;
val1 = exp(-Vsqr / 2.0) / sqrt( 2.0 * pi);
val2 = c3 * (V^2 -1.0) + c4 * V * (3.0 - V^2) - ...
c6 * V * (V^4 - 10. * V^2 + 15.0);
q = 0.5 * erfc (V/sqrt(2.0));
pd =  q - val1 * val2;
return
else
snr = 1.0;
gamma0 = incomplete_gamma(vt/beta,np);
a1 = (vt / beta)^np / (exp(factor(np)) * exp(vt/beta));
sum = gamma0;
for i = 1:1:np
temp1 = 1;
if (i == 1)
ai = a1;
else
ai = (vt / beta) * a1 / (np + i -1);
end
a1 = ai;
gammai = gamma0 - ai;
gamma0 = gammai;
a1 = ai;
for ii = 1:1:i
temp1 = temp1 * (np + 1 - ii);
end
term = (snrbar /2.0)^i * gammai * temp1 / exp(factor(i));
sum = sum + term;
end
pd = 1.0 - sum / beta^np;
end
pd = max(pd,0.);


fig2_14.m

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


## 三、资源自取

|
5天前
|

m基于Q-Learning强化学习的路线规划和避障策略matlab仿真
MATLAB 2022a仿真实现了Q-Learning算法在路线规划与避障中的应用，展示了智能体在动态环境中学习最优路径的过程。Q-Learning通过学习动作价值函数Q(s,a)来最大化长期奖励，状态s和动作a分别代表智能体的位置和移动方向。核心程序包括迭代选择最优动作、更新Q矩阵及奖励机制（正奖励鼓励向目标移动，负奖励避开障碍，探索奖励平衡探索与利用）。最终，智能体能在复杂环境中找到安全高效的路径，体现了强化学习在自主导航的潜力。
10 0
|
3天前
|

m基于BP译码算法的LDPC编译码matlab误码率仿真,对比不同的码长
MATLAB 2022a仿真实现了LDPC码的性能分析，展示了不同码长对纠错能力的影响。短码长LDPC码收敛快但纠错能力有限，长码长则提供更强纠错能力但易陷入局部最优。核心代码通过循环进行误码率仿真，根据EsN0计算误比特率，并保存不同码长（12-768）的结果数据。
24 9
|
4天前
|

matlab疲劳驾驶检测项目，Python高级面试framework
matlab疲劳驾驶检测项目，Python高级面试framework
24 0
|
6天前
|

13 4
|
7天前
|

11 1
|
7天前
|

m基于遗传优化的LDPC码OMS译码算法最优偏移参数计算和误码率matlab仿真
MATLAB2022a仿真实现了遗传优化的LDPC码OSD译码算法，通过自动搜索最佳偏移参数ΔΔ以提升纠错性能。该算法结合了低密度奇偶校验码和有序统计译码理论，利用遗传算法进行全局优化，避免手动调整，提高译码效率。核心程序包括编码、调制、AWGN信道模拟及软输入软输出译码等步骤，通过仿真曲线展示了不同SNR下的误码率性能。
10 1
|
7天前
|

17 0
|
7天前
|

18 1
|
7天前

40 1
|
7天前
|

28 0