% coding of y(t-1), y(t-2),..., y(t-m) function ty=codec(y) global m my t ty=0; for i=1:m ty=ty+my^(i-1)*(y(t-i)-1); end ty=ty+1;