ELEC 471, Spring 1999
Prof. Rich Kozick

## Homework 4

Date Assigned: Thursday, February 11, 1999
Date Due: Thursday, February 18, 1999

1. Reading: Continue studying Chapter 1, Sections 1.8 and 1.9. Also read Chapter 2 for class on February 18.

2. Please solve the following problems in the text:
Chapter 1: 1.8.2, 1.9.1, and graduate students also do 1.9.6.
Chapter 2: 2.2.3, 2.2.4, 2.2.5 (draw a tree), 2.2.6, and 2.2.9 (in part d, n refers to the number of tries before generating a busy signal).

3. Each student should individually implement MATLAB simulations of the digital communication system that we discussed in class. Recall that the observations at the receiver are modeled as

x = s + n

where the signal s and noise n are independent and take on the following values with the indicated probabilities:

```n       P[n]    s     P[s]
--      ----    --    ----

-2      0.1     -1    0.5
-1      0.2     +1    0.5
0       0.4
+1      0.2
+2      0.1
```

We discussed various "decision rules" in class whose purpose is to decide whether a -1 or +1 was transmitted based on the noisy observation x. We also calculated the probability of a bit error (also called bit error rate or BER) using mathematical analysis. Now we will use MATLAB to simulate the digital communication system and evaluate the BER for various situations, as described below.

1. Simulate the system with a decision rule that always chooses signal +1 when the received data is x = 0. Recall that the BER should be 0.2 for this case.

A sample MATLAB program digcom1.m is available to help you get started. This is the program that we developed in class on February 11.

2. Modify your previous simulation so that when x = 0 is received, your decision rule randomly chooses +1 with probability r and -1 with probability 1-r. Run for the cases r = 1, 0.5, and 0. Does changing r have any effect on the BER? Compare with the analytical BER.

3. Next modify your simulation program so that each bit is transmitted three times, with independent noise added on each transmission. Make your "overall" decision for each bit as the majority of the three individual decisions. (You can do the majority conveniently in MATLAB using the median function.) What is the BER for this system, for the cases of r = 1, 0.5, and 0 in your decision algorithm? Does the BER vary with r? Compare your simulation results with the analytical BER.

Hint: Your BER results may not agree with your analysis on homework 3 (even if you received full-credit). Think of the conditional probability of a bit error given that s = -1 was transmitted, and do the same given that s = +1 was transmitted. Then you should be able to obtain the correct analytical BER.

Please submit printouts of your MATLAB programs, BER results from running your programs (you will need to decide how many "trials" should be performed to get accurate results), and compare your simulation results with the analytical BER. You should explain clearly and completely how the analytical BER is calculated for each case. If you do things correctly, you should obtain excellent agreement between the simulated BER and the analytical BER!

Thank you.