That doesn't seem to make immediate sense: if you sample the same point twice in a row, then the delta from the previous point is 0 and that new term would vanish, but clearly optimization should not depend upon the history of which points you visited before and in which order.
Are you perhaps trying to put in a constraint about wanting the answer to be "close to" a given point? If so then the extra term you want should perhaps be more like sqrt( (x(1)-x0(1)).^2 + (x(2)-x0(2)).^2 + (x(3)-x0(3)).^2 )