EECE 5612 HW1
Stav Rones
2.2.2022
First, 0 mean noise with variance 1 was generated using randn(). The amplitude of the
potential signal, A, was calculated from the given SNR using the following equation.
𝐴 = 10𝑆𝑁𝑅𝑑𝘣/1&
The signal was then generated by adding the amplitude to the noise with a probability of
0.7, which was achieved by comparing a uniform number generator, rand(), to 0.3. The ML
decision rule was then applied, by comparing the signal to A / 2. The decision was then
compared to the label to determine a false positive (FP) or false negative (FN). This process was
performed 10,000 times, and the estimated values for 𝑃𝑓𝑝, 𝑃𝑓𝑛, and 𝑃𝑒 were calculated using
the following equations.
𝑃𝑓𝑛 𝐹𝑁 𝐹𝑃
= 𝑇𝑃 + , = 𝐹𝑃 + , = 𝐻𝑃 + 𝐻 𝑃𝑓𝑛
𝐹𝑁 𝑃𝑓𝑝 𝑇𝑁 𝑃 𝑃 0 𝑓𝑝 𝑃 1
This process was repeated 16 times for SNR values 0 to 15. The theoretical probability of
error, 𝑃𝑒 = 𝑃𝑓𝑝 = 𝑃𝑓𝑛 = 𝑄(𝐴), was plotted against the calculated values of 𝑃𝑓𝑝, 𝑃𝑓𝑛 and
2
𝑃𝑒 as
shown in the following figure with a logarithmic y axis. Note that 0 values cannot be shown on a
logarithmic axis.
SNR vs P(FP), P(FN), P(E)
0
10
Pthry
P(FP)
P(FN)
P(E)
10-10
10-20
Probability
10-30
10-40
10-50
10-60
0 5 10 15
SNR (db)
The same plot is shown below zoomed in.
0
SNR vs P(FP), P(FN), P(E)
10
10-1
Pthry P(FP)
P(FN)
-2 P(E)
10
Probability
10-3
10-4
10-5
0 1 2 3 4 5 6 7 8
SNR (db)
The behavior of the theoretical and calculated error probabilities are proportional and
decreasing as SNR increases. This makes sense because as the SNR increases, the normal
distribution of the signal value gets further away from the noise, making it much less likely for a
signal to be part of the incorrect distribution. It is interesting to note that the 𝑃𝑒 is closer to the
𝑃𝑓𝑛, which make sense because the 𝑃𝑒 considers the prior that the signal is more likely to occur.
This means that there will be more false negatives than false positives since there are more
opportunities for false negatives to occur than false positives.
Only two pages were converted.
Please Sign Up to convert the full document.
www.freepdfconvert.com/membership