Saturday 7 September 2013

Bit stuffing in data frames[Matlab]

 
Bit stuffing in data frames[Matlab]
 
clc;

clear all;

msg=input('Input Message Binary Bit Stream: ');

count=0;

stuffcount=0;

[M N]=size(msg);

for j=1:N-5+stuffcount

for i=j:j+5

if msg(i)==1

count=count+1;

else

count=0;

break;

end

end

if count==6

msg=[msg(1:j+4) 0 msg(j+5:end)];

count=0;

stuffcount=stuffcount+1;

end

end

fprintf('Stream after the bit is stuffed:');

disp(msg);


No comments:

Post a Comment