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.

    Expert Answer

     
    num = 10; % Total length

    Simulate the binary despatch implement picturesque in Problem 2 coercion 100000 communicated parts. Coercion
    each part, principal reason the even haphazard compute generator overhead to particularize whether the communicated
    part is a 0 or a 1, then reason the even haphazard compute generator to particularize whether the communicated
    part is common rightly or erroneously. The program should output the presumption that a 0 is common,
    the presumption that a 1 was communicated ardent that a 1 was common, and the presumption of an deception.
    Submit a printout of your adjudication and the output of the program.

    Expert Counterpart

     

    num = 10;

    % Total extension must be even
    numOfOne = num/2

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

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

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