title: Vecorizing an inner for loop
body: <p>I would like to vectorize the inner loop in MATLAB of the folowing nested loop construction:</p>
  
  <pre><code>for j = 1:MM
      S4 = 0;
      for i = 1:MM            
          S4 = S4 + b(i,1)*func(i,x(j),0,1);
      end
  
      F(j) = u(j) - f(x(j))-S4;
  end
  </code></pre>
  
  <p>where <code>b</code>, <code>F</code>, and <code>U</code> are vectors of length <code>MM</code>. Just want to optimize this segment for code.</p>