clear all;
close all;
f=input('Enter the number of fliflops:');
x=input('Enter the number of outputs:');
trellis=struct('numInputSymbols',2,'numOutputSymbols',4,'numStates',4,'nextStates',[0 2;0 2;1 3;1 3],'outputs',[0 3;3 0;2 1;1 2]);
n=input('Enter the number of messages:')
for i=1:(n+(f))
msg(i)=input('Enter the messsage bits:');
end
code=convenc(msg,trellis);
fprintf('The convolution code is:');
fprintf('\n');
for i=1:((n*x)+(2^(f)))
fprintf('%d',code(i));
end
decoded=vitdec(code,trellis,3,'trunc','hard');
fprintf('\n');
fprintf('The decoded messsage is :');
for n=1:(n+2)
fprintf('%d',decoded(n));
end
O/P-
Enter the number of fliflops:2
Enter the number of outputs:2
Enter the number of messages:5
n =
5
Enter the messsage bits:1
Enter the messsage bits:0
Enter the messsage bits:0
Enter the messsage bits:1
Enter the messsage bits:1
Enter the messsage bits:0
Enter the messsage bits:0
The convolution code is:
11101111010111
The decoded messsage is :1001100>>
No comments:
Post a Comment