0% found this document useful (0 votes)
7 views1 page

Stopandwait M

The document is a MATLAB script that simulates the transmission of frames with random outcomes. It prompts the user for the number of frames and processes each frame, displaying messages for timeouts, positive acknowledgments (PAK), and negative acknowledgments (NAK). The script counts the total number of attempts made during the transmission process.

Uploaded by

amk81830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Stopandwait M

The document is a MATLAB script that simulates the transmission of frames with random outcomes. It prompts the user for the number of frames and processes each frame, displaying messages for timeouts, positive acknowledgments (PAK), and negative acknowledgments (NAK). The script counts the total number of attempts made during the transmission process.

Uploaded by

amk81830
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

clc;

clear all;
k=0;
disp('SAMPLE INPUT AND OUTPUT: ');
n=input('Number of Frames: ');
frame=1;
while frame<=n
fprintf('Transmitting Frame %d\n',frame);
s=randint(1,1,10);
if s<3
fprintf('TIME OUT\n Re-');
k=k+1;
elseif s>6
fprintf('PAK of Frame %d Received\n',frame);
frame=frame+1;
k=k+1;
else
fprintf('NAK of Frame %d Received\n Re-',frame);
k=k+1;
end
end

You might also like