title: How to call automatically symbolic variables in a loop in Matlab
body: <p>Is there anyway to use a loop index to call symbolic variables in Matlab? For example, consider the following code whose goal is to store the symbolic expression "x1+x2+x3" in "y".</p>
  
  <pre><code>syms x1 x2 x3
  y = 0;
  
  for i = 1:3
      y = y + xi;
  end
  </code></pre>
  
  <p>The code does not work because on each iteration Matlab reads "y = y + xi" and returns the error "xi is undefined", instead of reading "y = y + x1", "y = y + x2" and "y = y + x3", is there anyway around this?</p>
  
  <p>Thanks.</p>