Hi tag,
Atan2 is restricted to -pi < atan <= pi, so when the angle increases past pi you get a jump down to -pi That occurs when x is negative and y passes through 0 on the negative x axis. If you consider x and y as z = x + iy in the complex plane, those lines are branch cuts and Matlab is doing a good job of showing them.
When both points have the same y value, the branch cuts cancel out to the left of the second point and you don't see any discontinuity there. (The branch cut remains in between the two points). With different y values you see both branch cuts.
A good way to get out of this is to go to complex notation. The psi2 calculation below puts the original code into the complex domain. The angle function does basically the same thing as atan2, so by using two angle functions psi2 comes out the same as psi1.
The psi3 version divides two complex functions to find the difference in angle between the the two of them, then finds that angle. This effectively allows the two branch cuts to cancel, and the resulting plot has no discontinuities, except on the line between the two points.
[x,y] = meshgrid(-25:0.1:25);
m=5;
U=1;
p1 = [3 -8];
p2 = [7 -4];
psi1 = U*(y*cos(pi/4)-x*sin(pi/4))-m*atan2(y-p2(2),x-p2(1))+m*atan2(y-p1(2),x-p1(1));
figure(1)
contour(x,y,psi1,100);
colorbar
grid on;
z = x+i*y;
z1 = p1(1) + i*p1(2);
z2 = p2(1) + i*p2(2);
u = (z2-z1)/abs(z2-z1);
psi2 = imag(z/u) -m*angle(z-z2) + m*angle(z-z1);
figure(2)
contour(x,y,psi2,100);
colorbar
grid on;
psi3 = imag(z/u) -m*angle((z-z2)./(z-z1));
figure(3)
contour(x,y,psi3,100);
colorbar
grid on;