% verif

clc; close all;

trellis       = poly2trellis([7],[171 133]);

load data.dat;
N=length(bitdiff)

InitStateCode = 10   
[cbits fstate]=convenc(bitdiff,trellis,InitStateCode);
last_StateCode=fstate
N1=length(cbits)

bitdiffx3=[bitdiff;bitdiff;bitdiff];
  
[cbitsx3 fstate]=convenc(bitdiffx3,trellis,InitStateCode);
last_StateCode=fstate

max(abs(cbits-cbitsx3(1:N1)))
max(abs(cbits-cbitsx3(N1+1:2*N1)))
max(abs(cbits-cbitsx3(2*N1+1:3*N1)))
max(abs(cbitsx3(2*N1+1:3*N1)-cbitsx3(2*N1+1:3*N1)))

