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);
% Use MATLAB to build a simulation of Quiz 2.3. simulate the transmission % of 10000...
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...