function A = markov(n,q)

  A = zeros(n,1);
  A(1) = binornd(1,0.5);
  for i=2:n
	  A(i) = binornd(1,1-q+(2*q-1)*A(i-1));
  end
  A = num2str(A','%d');
end
