title: How to vectorize double loop in Matlab?
body: <pre><code>y = 0;
  
  for m = 0:variable
    for n = 0:m
      y = y + f(n,m);
    end
  end
  </code></pre>
  
  <p>I vectorized the inner loop this way,</p>
  
  <pre><code>y = 0;
  
  for m = 0:variable
    n = 0:m
    y = y + f(n,m);
  end
  </code></pre>
  
  <p>This resulted in around 60% speed increase for my code. How do I also vectorize the outer loop?</p>