EE526 Homework 3
Kevin Mack, Clarkson University 03/08/2018
Question 3:
In this question we consider the detection problem:
H
0
: X = N,
H
1
: Y = S + N
where S = [2 1]
T
is a known signal vector and N N
0, C
N
with
C
N
=
7
2
3
2
3
2
7
2
Decorrelation
Here we find a unitary Decorrelating Matrix U for N. We decide to decorrelate the noise due
to the fact that it simplifies the scalar threshold value calculation (which must be computed in
every loop). The decorrelation is performed through an eigenvalue decomposition. The new
problem can be stated as,
H
0
: Y = M,
H
1
: Y = R + M,
where M = UN, and R = US, and U is the unitary decorrelation matrix defined by,
C
M
= UC
N
U
T
.
With this problem, we will use the Neyman-Pearson Detector and generate an ROC curve.
The results are given in Figure 1, and the code to generate the figure is given in Listing 1 below.
(e) For P
fa
= 0.1, P
d
= 0.4.
(f) The Bayesian detector with equal priors is given by ρ = R
T
C
M
R.
Which yields H
1
=
x > 1.15
.
Listing 1: Matlab Code
1 %% EE526 Homework 3 Question 3
2 % Do Monte - Carlo a n a l y s i s and p l o t ROC curv e f o r d e t e c t o r
3
Homework 3 Page 1
4 S = [ 2 - 1 ] ; % o r i g i n a l s i g n a l v ec to r
5 C_N = [7 / 2 - 3 /2 ; -3/2 7 / 2 ] ; % o r i g i n a l Covarian ce matrix
6
7 % f i n d d e c o r r e l a t e d matrix
8 [U, D, W] = e i g (C_N) ;
9
10 C_M = U*C_N*U ;
11 C_M_i = inv (C_M) ;
12
13 % s e t t h r e s h o l d f o r np d e t e c t o r
14 rho_min = - 1 0 . 0 ;
15 rho_max = 1 0 . 0 ;
16 rho_step = 0 . 1 ;
17
18 rho = rho_min : rho_step : rho_ma x ;
19
20 % n umber of monte - c a r l o s i m u l a t i o n s
21 t r i a l s = 1 e5 ;
22
23 %% do f a l s e p o s i t i v e s f i r s t
24 fp = z e r o s ( s i z e ( rho , 2 ) , t r i a l s ) ;
25 T_fp = z e r o s ( s i z e ( rho , 2 ) , t r i a l s ) ;
26
27 f o r i = 1 : s i z e ( rho , 2 )
28 % ge n e r at e new no i s e f o r ev e r y s e t o f rho and ever y t r i a l
29 N = mvnrnd ( [ 0 0 ] , C_M, t r i a l s ) ;
30
31 % f i n d d e c o r r e l a t e d matrix
32 [U, D, W] = e i g (C_N) ;
33
34 % d e c o r r e l a t e
35 M = U*N( 1 : end , : ) ;
36 R = U*S ;
37
38 % r e s t a t e problem without cr o ss - terms ( d e c o r r e l a t e d n o i s e v a r i an ce )
39 % in t h i s case , no s i g n a l i s pr e s e n t ( j u s t n o i s e )
40 X = N ;
41 Y = M;
42
43 f o r j = 1 : t r i a l s
44 T_fp ( i , j ) = 1 . /R *C_M_i*Y( : , j ) ;
45 i f T_fp ( i , j ) > rho ( i )
46 fp ( i , j ) = 1 ;
47 end
48 end
49 end
50
Homework 3 Page 2
51 %% do tr u e p o s i t i v e s now
52 tp = z e r o s ( s i z e ( rho , 2 ) , t r i a l s ) ;
53 T_tp = z e r o s ( s i z e ( rho , 2 ) , t r i a l s ) ;
54 f o r i = 1 : s i z e ( rho , 2)
55 N = mvnrnd (S , C_M, t r i a l s ) ;
56
57 % f i n d d e c o r r e l a t e d matrix
58 [U, D, W] = e i g (C_N) ;
59
60 % d e c o r r e l a t e
61 M = U*N( 1 : end , : ) ;
62 R = U*S ;
63
64 % r e s t a t e problem without cr o ss - terms ( d e c o r r e l a t e d n o i s e v a r i an ce )
65 % t h i s ca s e has the s i g n a l pl u s n o i s e
66 X = S + N ;
67 Y = R + M;
68
69 f o r j = 1 : t r i a l s
70 T_tp( i , j ) = 1 . /R *C_M_i*Y( : , j ) ;
71 i f T_tp( i , j ) > rho ( i )
72 tp ( i , j ) = 1 ;
73 end
74 end
75 end
76
77 % c a l c u l a t e t r ue and f a l s e p o s i t i v e r a t e s
78 fp_rat e = f p * ones ( t r i a l s , 1) . / t r i a l s ;
79 tp_rate = tp * one s ( t r i a l s , 1) . / t r i a l s ;
80
81 m a rk e r si z e = 8 ;
82 f i g u r e
83 hold a l l
84 g r i d on
85 g r i d minor
86 p l o t ( fp_rate , tp_rate )
87 p l o t ( 0 . 1 , 0 .4 25 , r * , m ar k e rs i z e , markersiz e , MarkerFaceColor , r )
88 p l o t ( 0 . 1 9 2 7 , 0 . 59 0 8 , go , ma r k er s ize , m a r k e r size , MarkerFaceColor , g-
)
89 x l a b e l ( F als e P o s i t i v e Rate )
90 y l a b e l ( True Po s i t i v e Rate )
91 t i t l e ( ’ROC Curve )
92 le g e n d ( ’ROC Curve , ’P_{ f a } = 0 .1 , Bayesian De t e c t o r )
Homework 3 Page 3
Figure 1: This graph depicts the ROC curve for the detector given in Question 3. The points
marked on the graph are the threshold point for the Bayesian Decision Rule assuming equal
priors, and the red asterisk marks the point where P
fa
= 0.1. The curve is the result of a
Monte-Carlo simulation with 1e
6
simulations.
Homework 3 Page 4