function p = P(x,A,C) x=x+1; if isempty(x) p = 1; else p = C(x(1)); end for j=2:length(x) p = p * A(x(j),x(j-1)); % markov case end return