MATLAB Assignment 3
In a binary communication system, a logic "1" occurs with probability p and is transmitted as the symbol
$S_1 = A$ while a logic "0" is transmitted as the symbol $S_0 = -A$. If X is the random variable representing
the transmitted sequence of bits, X can be represented as follows
$X = \begin{cases} S_1 = A & \text{logic "1"} & P[X = S_1] = p \\ S_0 = -A & \text{logic "0"} & P[X = S_0] = 1-p \end{cases}$
Noise is added to the signal during transmission so that the received base band signal can be expressed as
$Y = X + Z$, where Z represents the noise signal which is assumed to be Gaussian (normal) with zero mean and
standard deviation $\sigma$. At the receiver, the received signal, Y, is compared to a threshold voltage level, $V_{th}$.
When both symbols are equally likely, the threshold is given by
$V_{th} = \frac{S_1 + S_0}{2}$
If Y is above the threshold it's interpreted as a logic "1" and is interpreted as a logic"0" otherwise.
α. Find $V_{th}$ if $p = 0.5$.
b. Write a MATLAB script to simulate a binary communication system in the presence of noise and
calculate the probability of error, P(e), take $p = 0.5$ $A = 5V$ and $\sigma = 2 V$, compare to the
theoretical value derived in class.
c. Use MATLAB to calculate the correlation coefficient between X and Y, $\rho_{X,Y}$
d. Run the script for $\sigma = 1V, 2V and 4V$, in each case find P(e) and the correlation coefficient $\rho_{X,Y}$.
Observe the relationship between P(e) and the correlation coefficient. What does increasing $\sigma$
physically represent in this scenario? Did the simulation results align with your predictions? Explain.
e. For $\sigma = 2 V$, $A = 5V$, Compare P(e) and $\rho_{X,Y}$, to the MATLAB example covered in the lecture
entitled 'MATLAB EXAMPLES Hypothesis Testing' for ON OFF signaling where a logic "1" is
transmitted as A Volts while logic "0" is transmitted as 0 V. You should expect P(e) to be lower
than the example covered in slides, can you explain why?
f. Now assume that the probability model of noise, Z, is unknown and you only have sample
measurements of the noise process saved in the .mat file 'Noise_Samples' provided with this
assignment. The noise samples are saved in the variable 'Z_samples'. Use the noise measurements
given to estimate the probability model of the noise and create the noise sample values for the
simulation. Follow the example in the slides to plot $P[S_0] f_{Y|S_0}(y)$ and $P[S_1] f_{Y|S_1}(y)$. Take $P[S_1] =$
$p = 0.55$ in this case. From the intersection of $P[S_0] f_{Y|S_0}(y)$ and $P[S_1] f_{Y|S_1}(y)$, find $V_{th}$ and use it
simulate the binary system and find P(e). Take $A = 5V$.