Binary Communication Channel Matlab Please help for part a i

Binary Communication Channel Matlab- Please help, for part a i think the code is

p = 0.488

x = (rand(1,5000)) < p;

In this project, you are to simulate a simple binary communication channel characterized by appropriate conditional and prior probabilities and estimate the probability of error as well as the probability of receiving either a 1 or a 0. We start out with a symmetric binary communication channel characterized by the conditional probabilities Pr[0R|0S] = Pr[1R|1S] = 0.975 and Pr[0R|1S] = Pr[1R|0S] = 0.025. The prior probabilities of a 0 or a 1 are given by Pr[0S] = 0.512 and Pr[1S] = 0.488. The input to the binary communication channel is to be a sequence of 0s and 1s. Each 0 or 1 in the sequence is statistically independent of the others and is generated according to the probabilities Pr[0S] and Pr[1S] given above.

1. Generate the data input sequence of 0s and 1s according to the required probabilities. The size of the sequence is your choice; however, to obtain meaningful results, it should be at least 5000 points long.

2. Simulate the channel by writing a computer program to do the following: (a) When a 0 is presented as input to the channel, the channel should generate an output of 0 with probability Pr[0R|0S] and an output of 1 with probability Pr[1R|0S] (where these numerical values are given above). (b) When a 1 is presented to the channel, the channel should generate a 0 with probability Pr[0R|1S] and a 1 with probability Pr[1R|1S].

3. Compute the theoretical values for the following probabilities: Pr[0S|0R], Pr[1S|1R], and Pr[error] (see Section 2.5.1).

4. Apply the input data sequence generated in Step 1 to the channel in Step 2, estimate the probabilities in Step 3. To estimate the probability, use relative frequency; for example, to estimate Pr[0S|0R] you would compute {#times 0 sent and 0 received)/ (#times 0 received)

Solution

or in a one-liner:

Explanation

Here r is a uniformly distributed random number between 0 and 1. To generate an integer number between 1 and 0, the trick is to divide the [0, 1] range into 2 segments, where the length of each segment is proportional to its corresponding probability. In your case, you would have:

The probability of r falling within any of the segments is proportional to the probabilities you want for each number. sum(r >= cumsum([0, prob])) is just a fancy way of mapping an integer number to one of the segments.

2. Let the input be x. The channel is modelled as follows.

if (x) // if input is 1

out = sum(rand >= cumsum([0, 0.025, 0.975]));

else // if input is 0

  out = sum(rand >= cumsum([0, 0.975, 0.025]));

3. P(error) = P(1S)P(0R/1S) + P(0S)P(1R/0S) = 0.488*0.025 + 0.512*0.025 = 0.025

P[0S/0R] = (P[0R/0S]P[0S])/P[0R] = 0.975*0.512/(P[0R/0S]*P[0S]+P[0R/1S]*P[1S])

= 0.975*0.512/(0.975*512 + 0.025*0.488) = 0.9761

4.

// source

for count=1:5000 // 5000 bit long sequence.

//channel

if (x) // if input is 1

out = sum(rand >= cumsum([0, 0.025, 0.975]));

else // if input is 0

  out = sum(rand >= cumsum([0, 0.975, 0.025]));

if(x==0 && out==0)

P0S0R = P0S0R + 1; // calculating the number of times 0Sent/ 0Received

else if(x==1 && out==1)

P1S1R = P1S1R + 1;

end

end

Binary Communication Channel Matlab- Please help, for part a i think the code is p = 0.488 x = (rand(1,5000)) < p; In this project, you are to simulate a sim
Binary Communication Channel Matlab- Please help, for part a i think the code is p = 0.488 x = (rand(1,5000)) < p; In this project, you are to simulate a sim

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site