Vous êtes sur la page 1sur 2

EE684A: Fiber-Optic Communications

Due on 11/10/2017

Assignment #4

1. Recall the definitions of 𝑄(𝑥) function and erfc(𝑥) functions:



1 𝑦2
𝑄(𝑥) = ∫ exp (− ) 𝑑𝑦
√2𝜋 𝑥 2


2
erfc(𝑥) = ∫ exp⁡(−𝑦 2 ) 𝑑𝑦
√𝜋 𝑥
1 𝑥
Show that 𝑄(𝑥) = erfc ( ).
2 √2

2. Using MATLAB or tables of functions in Mathematical Handbooks, determine the value of 𝑥 such
that 𝑄(𝑥) = 10−3 , 10−6 , ⁡10−9 , and⁡10−12. Use erfc() in MATLAB for this exercise.

3. Suppose we wish to determine Pr[𝑋 > 1.5] where 𝑋 is zero-mean Gaussian random variable with
variance=2. Using MATLAB's erfc() above determine this probability. Now, execute the code given
below and find the probability P of 𝑋 > 1.5 as determined on a computer. Compare the two values.
Do you notice any difference? Explain the difference.

clear
clc
Nid=1000;
cnt=0;
trials=0;
trialsMax=10000;
X=zeros(1,trialsMax);
while cnt<Nid
X(trials+1)=?+?*randn(1);
if X(trials+1)>=1.5
cnt=cnt+1;
end
trials=trials+1;
if trials>trialsMax
break
end
end
P=cnt/trials;

Notes.

 In the code above, you should substitute appropriate numbers in place of ?


 The code generates an instance of r.v X repeatedly until the number of outcomes X > 1.5
reaches Nid.

Is there a better way of specifying trialsMax in the above code? Perhaps, using some inequalities?
Explore this option.
4. Consider the following code. This code implements (not efficiently) AWGN communication system
for baseband BPSK transmission. The symbols 𝑎1 = 1 and 𝑎2 = −1 are equally likely to occur. The
AWGN has zero mean and variance of 1.5. We transmit one symbol (d), add noise (n), and process
the corrupted symbol (z). For demodulation. we use a simple threshold detector with threshold at 0.
Execute the code ten times and record your results in a table. Make sure you input the correct
values in place of ? in the code before executing.

clear
clc
a1=1;
a2=-1;
vn=1.5;
n=?*randn(1);
d=(rand>0.5);
if d==1
z_nonoise=a1;
else
z_nonoise=a2;
end
z=z_nonoise+n;

if z>0
d_hat=1;
else
d_hat=-1;
end
dec_check=(d_hat==?); % This variable will be 1 if decision is correct and
0 if the decision is incorrect.

5. You must be tired of executing the code ten times to generate a table and would not consider
doing it 10000 times. Improve the code so that you do not have to manually execute 10000 times.
Set a value of noise variance such that SNR is 5 dB with 𝑎1 = 1 and 𝑎2 = −1 being symbol
amplitudes. Count the number of times that the decision is in error and compute the BER. Compare
this to BER that you expect theoretically from the given value of 5 dB SNR.

Vous aimerez peut-être aussi