title: Numerical 2D integration in Matlab
body: <p>Let's say I have the following vector field of force:</p>
  <pre><code>x = [-1 -0.5 0 0.5 1];
  y = x;
  dx = repmat([1,0.5,0,-0.5,-1],5,1);
  dy = repmat([1,0.5,0,-0.5,-1]',1,5);
  [X,Y] = meshgrid(x,y);
  </code></pre>
  <p><a href="https://i.stack.imgur.com/WjMwA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjMwA.png" alt="enter image description here" /></a></p>
  <p>I want to obtain an energy landscape from this field.
  If I just sum vectors I have the asymmetric picture:</p>
  <pre><code>imagesc(x,y,cumsum(dx,2)+cumsum(dy,1))
  </code></pre>
  <p><a href="https://i.stack.imgur.com/ng5yj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ng5yj.png" alt="enter image description here" /></a></p>
  <p>What is wrong in my code?</p>