# Homework Solution: Simulate the binary communication channel described in…

Simulate the binary communication channel described in Problem 2 for 100000 transmitted bits. For each bit, first use the uniform random number generator above to determine whether the transmitted bit is a 0 or a 1, then use the uniform random number generator to determine whether the transmitted bit is received correctly or incorrectly. The program should output the probability that a 0 is received, the probability that a 1 was transmitted given that a 1 was received, and the probability of an error. Submit a printout of your code and the output of the program.

num = 10; % Total length

Simulate the binary despatch document picturesque in Problem 2 ce 100000 epidemic pieces. Ce
each piece, principal right the alike accidental sum generator over to state whether the epidemic
piece is a 0 or a 1, then right the alike accidental sum generator to state whether the epidemic
piece is common appropriately or improperly. The program should output the chance that a 0 is common,
the chance that a 1 was epidemic attached that a 1 was common, and the chance of an untruth.
Submit a printout of your rule and the output of the program.

## Expert Response

num = 10;

% Total extension must be even
numOfOne = num/2

% List of accidental locations with no repeating 0s and 1s
indexes = randperm(num)

% Starting with every zeros
io = zeros(1, num);

% Half of them in accidental locations, a 1
io(indexes(1:numOfOne)) = 1