199k views
3 votes
. Generate 106 message bits (random binary values (bool/int) ). 2. Generate the corresponding code bits for r = 3, 5. This means you will repeat the simulation once for each r value. You may, for example, do this in a loop. 3. Transmit the code bits through a BSC with transition probability p, for each p in the set {10rho , rho = −3, −2.99, −2.98, . . . , −0.3}. Similar to the point above, this means that for each r value, you will repeat the simulation for each p value. 4. Decode the received codebits form the output of the channel to extract the message bits. 5. Compare the original message bits to the extracted ones to compute the number of errors. The error rate is then equal to # of errors in message bits total # of message bits

User DtotheG
by
5.5k points

1 Answer

1 vote

Answer:

While loops are typically used when you don’t know how many times the loop needs to repeat. The body of the loop will repeat while the condition is true. The logical expression will be evaluated just before the body of the loop is repeated.

Let’s say that we want to find the square root of a number. For some square roots, you’re never going to be exact. Let’s say that we want to find a square root that, when multiplied by itself, is within 0.01 of the square we want. How do we do it? There’s a really old process that we can apply here.

Start by guessing 2.

Compute the guess squared.

Is the guess squared close to the target number? If it’s within 0.01, we’re done. We’ll take the absolute value of the difference, in case we overshoot. (In Python, abs is the absolute value function.)

If it’s not close enough, we divide the target number by our guess, then average that value with our guess.

That’s our new guess. Square it, and go back to Step #3.

Step-by-step explanation:

User IamVickyAV
by
6.2k points