Question

% Use MATLAB to build a simulation of Quiz 2.3. simulate the transmission % of 10000 packets, each containing 100 bits. Count the number of packets % that abilities. Also calculate the probability of a packet is decoded % correctly. Compare your numbers from MATLAB with your theoretical % calculation. (Hint: look at Example 2.25.) -close all -clear all clc x = randi ( [0 1] , 100, 10000) ; numel (X) -nume l (X (find (Х--1 ) ) ) for i-1 I for i-1 I

Quiz 2.3 packets containing 100 bits are transmitted over a communication link. A Data transmitted bit is received in error (either a 0 sent is mistaken for a l, or a is mistaken for a 0) with probability c 0.01, independent of the correctness of any other bit. The packet has been coded in such a way that if three or fewer bits are received in error, then those bits can be corrected. If more than three bits are received in error, then the packet is decoded with errors. 1 sent (a) Let B ,100- denote the event that a received packet has k bits in error and 100 k correctly decoded bits. What is P Ek.100-k for k-0,1,2,3? (b) Let C denote the event that a packet is decoded correctly. What is P[C]?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

clear

k0=0;
k1=0;
k2=0;
k3=0;
packets=1000;
corrected=0;
for packet=1:packets
    errorBit=0;
    maxab=0;
    for bits=1:100
        if rand<=.01
            errorBit=errorBit+1;
        end
    end
    if errorBit==0
        k0=k0+1;
    elseif errorBit==1
        k1=k1+1;
    elseif errorBit==2
        k2=k2+1;
    elseif errorBit==3
        k3=k3+1;
    end
  
    if errorBit<=3
        corrected=corrected+1;
    end
end

k=[k0,k1,k2,k3];
for i=1:4
fprintf('Probability that received packet %d bits in error: %.4f ',i-1,k(i)/packets);
end
fprintf('Probability that a packet is decoded correctly: %.4f ',corrected/packets);

Command Window >>DataPacketsErrorProbability Probability that received packet 0 bits in error: 0.3570 Probability that received packet 1 bits in error: 0.3710 Probability that received packet 2 bits in error: 0.1930 Probability that received packet 3 bits in error: 0.0630 Probability that a packet is decoded correctly: 0.9840 >>DataPacketsErrorProbability Probability that received packet 0 bits in error: 0.3870 Probability that received packet 1 bits in error: 0.3650 Probability that received packet 2 bits in error: 0.1740 Probability that received packet 3 bits in error: 0.0600 Probability that a packet is decoded correctly: 0.9860 >>DataPacketsErrorProbability Probability that received packet 0 bits in error: 0.3770 Probability that received packet 1 bits in error: 0.3550 Probability that received packet 2 bits in error: 0.1800 Probability that received packet 3 bits in error: 0.0700 Probability that a packet is decoded correctly: 0.9820 >>DataPacketsErrorProbability Probability that received packet 0 bits in error: 0.3720 Probability that received packet 1 bits in error: 0.3640 Probability that received packet 2 bits in error: 0.1840 Probability that received packet 3 bits in error: 0.0620 Probability that a packet is decoded correctly: 0.9820

Add a comment
Know the answer?
Add Answer to:
% Use MATLAB to build a simulation of Quiz 2.3. simulate the transmission % of 10000...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a...

    QUIZ 2.3 EXAMPLE 2.25 Please help me build the MATLAB code Use MATLAB to build a simulation of Quiz 2.3. Simulate the transmission of 10000 packets, each containing 100 bits. Count the number of packets that contain no error, one, two, three- bit errors, calculate their probabilities. Also calculate the probability of a packet is decoded correctly. Compare your numbers from MATLAB with your theoretical calculation. (Hint: look at Example 2.25.) Data packets containing 100 bits are transmitted over a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT