title: Compute Cumulative Returns in Matlab
body: <p>If I have a vector of returns, is there a way to convert it to a cumulative returns vector in Matlab?</p>
  
  <p>There is a very useful function in R called chart.CumReturns funcion from the PerformanceAnalytics package. Is there any similar function in Matlab?</p>
  
  <p>Otherwise, I would like to do it manually in Matlab</p>
  
  <p>For example, having the vector of returns:</p>
  
  <pre><code>r = [r1 r2 .. rn]
  </code></pre>
  
  <p>I would like to obtain the vector of cumulative returns such that:</p>
  
  <pre><code>rc = [rc1 rc2 ..rcn]
  </code></pre>
  
  <p>where:</p>
  
  <pre><code>rc1 = r1
  rc2 = (1+r1)*(1+r2)-1
  rcn = (1+r1)*(1+r2)*...(1+rn)-1
  </code></pre>
  
  <p>Since I'm new to Matlab, I don't know exactly how to structure a loop over this vector.</p>
  
  <p>Thanks,</p>