title: matlab - find all possible vectors satisfying irregular constraints
body: <p>In Matlab, I need to find all possible combinations of a vector that satisfies some constraints that I find quite irregular. </p>
  
  <p>The vector, <code>x</code>, has 12 entries: <code>x_0,x_1,...,x_11</code></p>
  
  <p>Local constraints:</p>
  
  <pre><code>x_0 in {1,...,6}
  
  x_i in {0,...,6}, i = 1,...,6
  
  x_j in {0,...,12-j}, j = 7,...,11
  </code></pre>
  
  <p>Global constraints:</p>
  
  <pre><code>sum(x) = 12
  
  for any k, x_k = y ==&gt; x_{k+j} = 0 for j = 1,...,y-1
  </code></pre>
  
  <p>I have thought about this for quite a while now and can't seem to solve it myself - any ideas anyone?</p>