-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathth_match.m
116 lines (72 loc) · 1.82 KB
/
th_match.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
% clear all
close all
rng('shuffle')
%% Initialization
N = 4;
M = 2;
P = 16;
Z = 8;
K = 1;
fa = logspace(-1,-3,10);
var_n = 10^-(2);
var_c = var_n*1e3;
L = 0.5*(0:P-1)';
g = -1:1/Z:1;
S = [9] + length(g)*9;
mu = inf;
N_ = N*P*M;
PSL = 10*log10(log(length(g))/N/M);
%% Generate array
while 1
if M > 1
Zt = Z/2; Zr = Z/2;
zt = Zt*sort(rand(M,1)); zt(1) = 0;
zr = Zr*sort(rand(N,1));
else
Zr = Z;
zt = 0;
zr = Zr*sort(rand(N,1)); zr(1) = 0;
end
A_ra = generate_dictionary(zr,zt,g,P);
C_ra = generate_clutter(zr,zt,201,P);
R_c = inv(var_c(end)*C_ra*C_ra' + var_n(end)*eye(N_));
A_ = sum(abs(R_c*A_ra).^2,1);
[P_,I_] = sort(A_);
I_ = I_(1:19);
P_map = abs(A_ra'*R_c*A_ra(:,S(1))).^2;
P_map2 = sort(P_map,'descend');
mu = 10*log10(P_map2(2)/P_map2(1))
P_map = reshape(P_map,17,17);
if mu < PSL-1
break
end
end
%% Monte Carlo Simulations
ex = 1e4;
x = sqrt(P_map2(1));
Pd = zeros(length(fa),1);
Pf = Pd;
A_raS = A_ra(:,S);
for i = 1:ex
clc
[i/ex mu]
% Pd/(i-1)/K
[Pf/(i-1) fa']
% Generate secondary data
Z_ra = sqrt(var_n/2)*(randn(N_,2*N_) + randn(N_,2*N_)*1i) + sqrt(var_c/2)*C_ra*(randn(size(C_ra,2),2*N_) + randn(size(C_ra,2),2*N_)*1i);
% Generate primary data
y_ra = A_raS*exp(1i*2*pi*rand(K,1)) + sqrt(var_n/2)*(randn(N_,1) + randn(N_,1)*1i) + sqrt(var_c/2)*C_ra*(randn(size(C_ra,2),1) + randn(size(C_ra,2),1)*1i);
% Perform detection
% [S_AMF,P2] = STAP_BF(y_ra,A_ra,Z_ra,t);
S_MP2 = MBMP_STAP2(y_ra,A_ra,[],fa,R_c);
% Record results
for f = 1:length(fa)
Pd(f,:) = Pd(f,:) + length(intersect(S_MP2(f).S,S));
Pf(f,:) = Pf(f,:) + 1 - isempty(setdiff(S_MP2(f).S,S));
end
% if b>0
% clc
% end
end
Pd = Pd/ex/K;
Pf = Pf/ex;